{"id":13476160,"url":"https://github.com/vanniktech/gradle-code-quality-tools-plugin","last_synced_at":"2025-05-16T05:06:21.331Z","repository":{"id":3134631,"uuid":"48543162","full_name":"vanniktech/gradle-code-quality-tools-plugin","owner":"vanniktech","description":"Gradle plugin that generates Checkstyle, PMD, CPD, Lint \u0026 Ktlint Tasks for every subproject.","archived":false,"fork":false,"pushed_at":"2025-05-14T08:18:18.000Z","size":1096,"stargazers_count":355,"open_issues_count":0,"forks_count":25,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-14T09:34:24.505Z","etag":null,"topics":["android","checkstyle","code-quality","cpd","gradle","gradle-plugin","groovy","java","kotlin","ktlint","lint","pmd"],"latest_commit_sha":null,"homepage":"http://vanniktech.com","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanniktech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["vanniktech"]}},"created_at":"2015-12-24T13:10:30.000Z","updated_at":"2025-05-14T08:18:10.000Z","dependencies_parsed_at":"2023-11-22T19:26:30.473Z","dependency_job_id":"66a651fc-ac8d-4bef-8ae2-e55b1895642a","html_url":"https://github.com/vanniktech/gradle-code-quality-tools-plugin","commit_stats":{"total_commits":310,"total_committers":9,"mean_commits":34.44444444444444,"dds":"0.26774193548387093","last_synced_commit":"0c955a9fd0eb3acd3e1c4772d8622387c3af363e"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2Fgradle-code-quality-tools-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2Fgradle-code-quality-tools-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2Fgradle-code-quality-tools-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2Fgradle-code-quality-tools-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanniktech","download_url":"https://codeload.github.com/vanniktech/gradle-code-quality-tools-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","checkstyle","code-quality","cpd","gradle","gradle-plugin","groovy","java","kotlin","ktlint","lint","pmd"],"created_at":"2024-07-31T16:01:27.191Z","updated_at":"2025-05-16T05:06:21.311Z","avatar_url":"https://github.com/vanniktech.png","language":"Kotlin","readme":"# gradle-code-quality-tools-plugin\n\nGradle plugin that configures [Checkstyle](http://checkstyle.sourceforge.net/), [PMD](https://pmd.github.io/), [CPD](https://pmd.github.io/pmd-6.0.0/#cpd), [Lint](https://developer.android.com/studio/write/lint.html), [Detekt](https://github.com/arturbosch/detekt) \u0026 [Ktlint](https://github.com/shyiko/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.\n\nThis plugin requires Gradle 5.0 or later.\n\n# Set up\n\n**root/build.gradle**\n\n```gradle\nbuildscript {\n  repositories {\n    mavenCentral()\n    google()\n  }\n  dependencies {\n    classpath \"com.vanniktech:gradle-code-quality-tools-plugin:0.24.0\"\n  }\n}\n\napply plugin: \"com.vanniktech.code.quality.tools\"\n```\n\n### Snapshot\n\n```gradle\nbuildscript {\n  repositories {\n    maven { url \"https://oss.sonatype.org/content/repositories/snapshots\" }\n  }\n  dependencies {\n    classpath \"com.vanniktech:gradle-code-quality-tools-plugin:0.25.0-SNAPSHOT\"\n  }\n}\n\napply plugin: \"com.vanniktech.code.quality.tools\"\n```\n\n## Configuration\n\nThe 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 }`.\n\nThose are all the available configurations - shown with default values and their types. More information can be found in the [Kotlin Documentation of the Extension](src/main/kotlin/com/vanniktech/code/quality/tools/CodeQualityToolsPluginExtension.kt) and the respective extensions for designated integrations.\n\n```groovy\ncodeQualityTools {\n  boolean failEarly = true\n  boolean xmlReports = true\n  boolean htmlReports = false\n  boolean textReports = false\n  String[] ignoreProjects = []\n\n  checkstyle {\n    boolean enabled = true\n    String toolVersion = '8.6'\n    String configFile = 'code_quality_tools/checkstyle.xml'\n    Boolean ignoreFailures = null\n    Boolean showViolations = null\n    String source = 'src'\n    List\u003cString\u003e include = ['**/*.java']\n    List\u003cString\u003e exclude = ['**/gen/**']\n  }\n  pmd {\n    boolean enabled = true\n    String toolVersion = '6.0.0'\n    String ruleSetFile = 'code_quality_tools/pmd.xml'\n    Boolean ignoreFailures = null\n    String source = 'src'\n    List\u003cString\u003e include = ['**/*.java']\n    List\u003cString\u003e exclude = ['**/gen/**']\n  }\n  lint {\n    boolean enabled = true\n    Boolean textReport = true\n    String textOutput = 'stdout'\n    Boolean abortOnError = null\n    Boolean warningsAsErrors = null\n    Boolean checkAllWarnings = null\n    String baselineFileName = null\n    Boolean absolutePaths = null\n    File lintConfig = null\n    Boolean checkReleaseBuilds = false\n    Boolean checkTestSources = null\n    Boolean checkDependencies = null\n  }\n  ktlint {\n    boolean enabled = true\n    String toolVersion = '0.32.0'\n    boolean experimental = false\n  }\n  detekt {\n    boolean enabled = true\n    String toolVersion = '1.0.0'\n    String config = 'code_quality_tools/detekt.yml'\n    String baselineFileName = null\n    boolean failFast = true\n  }\n  cpd {\n    boolean enabled = true\n    String source = 'src'\n    String language = 'java'\n    Boolean ignoreFailures = null\n    int minimumTokenCount = 50\n  }\n  kotlin {\n    boolean allWarningsAsErrors = true\n  }\n}\n```\n\n## Tools\n\nHere 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.\n\n### Checkstyle\n\nIt'll apply the [Checkstyle Plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html) and generate the `checkstyle` task that will execute checkstyle. The configuration properties of `codeQualityTools -\u003e checkstyle` mirror the [properties from the plugin](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.CheckstyleExtension.html).\n\n### PMD\n\nIt'll apply the [PMD Plugin](https://docs.gradle.org/current/userguide/pmd_plugin.html) and generate the `pmd` task that will execute pmd. The configuration properties of `codeQualityTools -\u003e pmd` mirror the [properties from the plugin](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.PmdExtension.html).\n\n### CPD\n\nIt'll apply the [CPD Plugin](https://github.com/aaschmid/gradle-cpd-plugin) and generate the `cpdCheck` task that will execute cpd. The configuration properties of `codeQualityTools -\u003e cpd` mirror the [properties from the plugin](https://github.com/aaschmid/gradle-cpd-plugin#options).\n\n### Lint\n\nThis will only work when one of the Android Plugins (`com.android.application`, `com.android.library`, etc.) are applied. The configuration properties of `codeQualityTools -\u003e lint` mirror the [properties from the lintOptions](https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.LintOptions.html).\n\n### Detekt\n\nIt'll use the specified detekt version and generate the `detektCheck` task which will run detekt on your code base.\n\n### Ktlint\n\nIt'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.\n\n**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.\n\n# License\n\nCopyright (C) 2016 Vanniktech - Niklas Baudy\n\nLicensed under the Apache License, Version 2.0\n","funding_links":["https://github.com/sponsors/vanniktech"],"categories":["Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanniktech%2Fgradle-code-quality-tools-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanniktech%2Fgradle-code-quality-tools-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanniktech%2Fgradle-code-quality-tools-plugin/lists"}