All Projects → vanniktech → Gradle Code Quality Tools Plugin

vanniktech / Gradle Code Quality Tools Plugin

Licence: apache-2.0
Gradle plugin that generates ErrorProne, Findbugs, Checkstyle, PMD, CPD, Lint, Detekt & Ktlint Tasks for every subproject.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects
groovy
2714 projects

Projects that are alternatives of or similar to Gradle Code Quality Tools Plugin

Gradle Static Analysis Plugin
Easy setup of static analysis tools for Android and Java projects.
Stars: ✭ 398 (+41.13%)
Mutual labels:  gradle, gradle-plugin, code-quality, checkstyle, findbugs, pmd
Gradle Quality Plugin
Gradle quality plugin for Java and Groovy
Stars: ✭ 97 (-65.6%)
Mutual labels:  gradle, gradle-plugin, checkstyle, findbugs, pmd
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-87.23%)
Mutual labels:  gradle, findbugs, pmd, checkstyle, code-quality
Gnag
A Gradle plugin that helps facilitate GitHub PR checking and automatic commenting of violations.
Stars: ✭ 120 (-57.45%)
Mutual labels:  gradle, checkstyle, findbugs, pmd
Okcheck
Incremental scan,integrate Lint、KtLint、UnitTest、Checkstyle、Findbugs、Pmd, powerful and easy to use
Stars: ✭ 285 (+1.06%)
Mutual labels:  lint, checkstyle, findbugs, pmd
Quality Checks
Gradle plugin which includes Checkstyle, FindBugs, and PMD basic configuration.
Stars: ✭ 38 (-86.52%)
Mutual labels:  gradle, checkstyle, findbugs, pmd
Codeanalysis
Android静态代码分析
Stars: ✭ 31 (-89.01%)
Mutual labels:  gradle-plugin, checkstyle, findbugs, pmd
java-quality-checks
No description or website provided.
Stars: ✭ 33 (-88.3%)
Mutual labels:  findbugs, pmd, checkstyle, code-quality
Android Starter
[Android Architecture] Android starter based on MVP/Dagger2/RxJava2/Robolectric/Espresso/Mockito. It provides a generator to fast create a Android template project.
Stars: ✭ 522 (+85.11%)
Mutual labels:  checkstyle, findbugs, pmd
Kotlin Android Starter
[Kotlin Android] Kotlin Android starter based MVP/Dagger2/RxJava2/Robolectric/Espresso/Mockito. It provides a generator to fast create a Kotlin Android project.
Stars: ✭ 589 (+108.87%)
Mutual labels:  checkstyle, findbugs, pmd
Debt-Manager
A personal app to store people that owe you money or you owe money to. "Mo Money Mo Problems" 🎵 - The Notorious B.I.G. 😎
Stars: ✭ 22 (-92.2%)
Mutual labels:  findbugs, pmd, checkstyle
Cflint
Static code analysis for CFML (a linter)
Stars: ✭ 156 (-44.68%)
Mutual labels:  lint, code-quality, findbugs
Warnings Ng Plugin
Jenkins Warnings Plugin - Next Generation
Stars: ✭ 248 (-12.06%)
Mutual labels:  checkstyle, findbugs, pmd
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+1378.37%)
Mutual labels:  gradle-plugin, lint, code-quality
Gradle Pitest Plugin
Gradle plugin for PIT Mutation Testing
Stars: ✭ 144 (-48.94%)
Mutual labels:  gradle, gradle-plugin, code-quality
gradle-build-info-plugin
Gradle plugin to include build information such as Git commit ID to your JAR. It can be used to show Git commit information with Spring Boot Actuator.
Stars: ✭ 33 (-88.3%)
Mutual labels:  gradle, gradle-plugin
gradle-localization-plugin
Gradle plugin for automating the download process of localization files.
Stars: ✭ 19 (-93.26%)
Mutual labels:  gradle, gradle-plugin
flake8-broken-line
🚨 Flake8 plugin to forbid backslashes (\) for line breaks
Stars: ✭ 85 (-69.86%)
Mutual labels:  lint, code-quality
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (-93.97%)
Mutual labels:  gradle, gradle-plugin
schema-registry-plugin
Gradle plugin to interact with Confluent Schema-Registry.
Stars: ✭ 60 (-78.72%)
Mutual labels:  gradle, gradle-plugin

gradle-code-quality-tools-plugin

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.

Set up

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

Snapshot

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"

Configuration

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
  }
}

Tools

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.

Error Prone

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.

Checkstyle

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.

PMD

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.

CPD

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.

Lint

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.

Detekt

It'll use the specified detekt version and generate the detektCheck task which will run detekt on your code base.

Ktlint

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.

License

Copyright (C) 2016 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].