Gradle plugin that configures Error Prone, Checkstyle, PMD, CPD, Lint, Detekt & Ktlint. All of these tools are also automatically hooked into the check
gradle task. Below, I'll go more into depth how each of those plugins are configured.
This plugin requires Gradle 5.0 or later.
root/build.gradle
buildscript {
repositories {
mavenCentral()
google()
gradlePluginPortal() // Required for the Errorprone Gradle Plugin.
}
dependencies {
classpath "com.vanniktech:gradle-code-quality-tools-plugin:0.20.0"
}
}
apply plugin: "com.vanniktech.code.quality.tools"
Information: This plugin is also available on Gradle plugins
buildscript {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.vanniktech:gradle-code-quality-tools-plugin:0.21.0-SNAPSHOT"
}
}
apply plugin: "com.vanniktech.code.quality.tools"
The philosophy of this plugin is to fail early. This means having zero warnings / errors reported from any tools. If you're just getting started with this in a large code base you might not be able to achieve this right away in which case you might want to set failEarly
to false
and then apply at a finer more granular scope how each tool should behave e.g. checkstyle { ignoreFailures = false }
.
Those are all the available configurations - shown with default values and their types. More information can be found in the Kotlin Documentation of the Extension and the respective extensions for designated integrations.
codeQualityTools {
boolean failEarly = true
boolean xmlReports = true
boolean htmlReports = false
boolean textReports = false
String[] ignoreProjects = []
checkstyle {
boolean enabled = true
String toolVersion = '8.6'
String configFile = 'code_quality_tools/checkstyle.xml'
Boolean ignoreFailures = null
Boolean showViolations = null
String source = 'src'
List<String> include = ['**/*.java']
List<String> exclude = ['**/gen/**']
}
pmd {
boolean enabled = true
String toolVersion = '6.0.0'
String ruleSetFile = 'code_quality_tools/pmd.xml'
Boolean ignoreFailures = null
String source = 'src'
List<String> include = ['**/*.java']
List<String> exclude = ['**/gen/**']
}
lint {
boolean enabled = true
Boolean textReport = null
String textOutput = 'stdout'
Boolean abortOnError = null
Boolean warningsAsErrors = null
Boolean checkAllWarnings = null
String baselineFileName = null
Boolean absolutePaths = null
File lintConfig = null
Boolean checkReleaseBuilds = false
Boolean checkTestSources = null
Boolean checkDependencies = null
}
ktlint {
boolean enabled = true
String toolVersion = '0.32.0'
boolean experimental = false
}
detekt {
boolean enabled = true
String toolVersion = '1.0.0'
String config = 'code_quality_tools/detekt.yml'
String baselineFileName = null
boolean failFast = true
}
cpd {
boolean enabled = true
String source = 'src'
String language = 'java'
Boolean ignoreFailures = null
int minimumTokenCount = 50
}
errorProne {
boolean enabled = true
String toolVersion = '2.1.3'
}
kotlin {
boolean allWarningsAsErrors = true
}
}
Here I'll give a bit more information about how each of the tools will be applied. If there's a Gradle task that this plugin will generate it will also be hooked up into the check
Gradle task. This means that when you execute check
all of the rools will be running for you.
It'll apply the Error Prone Gradle Plugin which will run together with assemble
. There's no report generated for this but you'll get compile warnings & errors.
It'll apply the Checkstyle Plugin and generate the checkstyle
task that will execute checkstyle. The configuration properties of codeQualityTools -> checkstyle
mirror the properties from the plugin.
It'll apply the PMD Plugin and generate the pmd
task that will execute pmd. The configuration properties of codeQualityTools -> pmd
mirror the properties from the plugin.
It'll apply the CPD Plugin and generate the cpdCheck
task that will execute cpd. The configuration properties of codeQualityTools -> cpd
mirror the properties from the plugin.
This will only work when one of the Android Plugins (com.android.application
, com.android.library
, etc.) are applied. The configuration properties of codeQualityTools -> lint
mirror the properties from the lintOptions.
It'll use the specified detekt version and generate the detektCheck
task which will run detekt on your code base.
It'll use the specified ktlint version and then generate two tasks. ktlint
which will run ktlint over your code and flag issues. ktlintFormat
will reformat your code.
Note: There might be some configuration properties that are not mirrored in which case feel free to open a PR. Personally, I don't have the need for all of them.
Copyright (C) 2016 Vanniktech - Niklas Baudy
Licensed under the Apache License, Version 2.0
Gradle 概述 特性说明 下面是一些 Gradle 特性的列表。 基于声明的构建和基于约定的构建 Gradle 的核心在于基于 Groovy 的丰富而可扩展的域描述语言(DSL)。 Groovy 通过声明性的语言元素将基于声明的构建推向下层,你可以按你想要的方式进行组合。 这些元素同样也为支持 Java, Groovy,OSGi,Web 和 Scala 项目提供了基于约定的构建。 并且,这种声
创建项目 1.新建一个 Dynamic Web Project 2.在项目根目录下新建 build.gradle 文件 3.右键项目Configure-Convert to Gradle Project,再次右键Gradle-Refersh All 4.右键项目Java EE Tools-Generate Deployment Descriptor Stub build.gradle文件如下所示
idea中gradle的设置,发现存在相关的默认设置“Offline work”。取消勾选“Offline work”就可以了。 依次打开如下菜单: Settings -> Build.Execution,Deployment -> Build Tools –> Gradle 在Globle Gradle settings中有“Offline work”项,取消掉勾选就可以了。
我们在亚马逊EC2的集群中,运行有针对所有组件的回归测试(包含其他第三方Nginx模块)。 最新的测试报告可以随时到此查阅: http://qa.openresty.org/
To continuously improve on the stability of phpDocumentor we make use of Wercker and Scrutinizer to verify and inspect the source code. Using Wercker we are able to run all automated tests, such as PH
描述 (Description) 设置0到100之间图像质量的值。 0.数字设置为lower quality ,其中100设置为higher quality 。 例子 (Example) ![My New Image](/images/maxresdefault.jpg?cropZoom = 300, 200&quality = 95) 输出 (Output) 上面的代码将获取以下输出 -
Image Quality Assessment This repository provides an implementation of an aesthetic and technical image quality model based on Google's research paper "NIMA: Neural Image Assessment". You can find a q
在我的Android项目构建中遇到了一个问题。我使用Grgit在Gradle中填充和。在我将Android Studio和gradle工具更新到更新版本(构建3.4.0和发行版5.1.1)之前,一切都运行得很好。 失败并显示错误: Task运行良好并显示: 模块build.gradle文件:
问题内容: I am trying to create a high quality thumbnail of this image, with Java and Scalr 3.2 This is the relevant source code, where and If I use , here is the result: If I use , here is the result: Wi