{"id":24969462,"url":"https://github.com/intrepidpursuits/static-analysis-gradle-plugin","last_synced_at":"2025-10-09T17:34:31.646Z","repository":{"id":151543783,"uuid":"87318666","full_name":"IntrepidPursuits/static-analysis-gradle-plugin","owner":"IntrepidPursuits","description":"Gradle wrapper for PMD and FindBugs","archived":false,"fork":false,"pushed_at":"2020-06-02T19:38:51.000Z","size":140,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-02-03T14:46:23.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntrepidPursuits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-04-05T14:24:14.000Z","updated_at":"2020-03-18T14:20:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fc0d596-7c51-48a6-b1b6-f1697f4f4bef","html_url":"https://github.com/IntrepidPursuits/static-analysis-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2Fstatic-analysis-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2Fstatic-analysis-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2Fstatic-analysis-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2Fstatic-analysis-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntrepidPursuits","download_url":"https://codeload.github.com/IntrepidPursuits/static-analysis-gradle-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140551,"owners_count":20729798,"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":[],"created_at":"2025-02-03T14:38:21.017Z","updated_at":"2025-10-09T17:34:26.616Z","avatar_url":"https://github.com/IntrepidPursuits.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static Analysis Gradle Plugin\n\n1. [Overview](#overview)\n1. [Usage](#usage)\n1. [Plugin Details](#plugin-details)\n    1. [PMD](#pmd)\n    1. [FindBugs](#findbugs)\n    1. [Android Lint](#android-lint)\n1. [Configuration](#configuration)\n1. [Publishing](#publishing)\n1. [License](#license)\n\n### Overview\nThe Static Analysis Gradle Plugin adds gradle tasks for running PMD and FindBugs, and includes a default configuration for these along with Android Lint that is common to most Intrepid Android projects.\n\n### Usage\nAdd the plugin to your project:\n```\nbuildscript {\n    repositories {\n        maven { url \"https://plugins.gradle.org/m2/\" }\n    }\n    dependencies {\n        classpath \"gradle.plugin.io.intrepid:static-analysis:1.2.1\"\n    }\n}\n\n// This MUST come after 'com.android.application' or 'com.android.library' plugin\napply plugin: \"io.intrepid.static-analysis\"\n```\n\nTo run pmd, use the command `./gradlew pmd`.\n\nTo run FindBugs, use the command `./gradlew findBugs${buildVariant}`. By default, this produces a html result. You can change it to produce a xml report instead by adding `findBugsXml` flag (FindBugs can only produce one type of report at a time).\nex: `./gradlew findBugsDebug -PfindBugsXml`\n\nAndroid Lint can be run using the standard `./gradlew lint${buildVariant}`\n\nTo run all three tasks in a single command, use `./gradlew analyze${buildVariant}`\n\nWhen updating the plugin version, it is recommended to run `./gradlew updateLintFile` to sync the project's lint rules with the library.\n\nNote for multi-module projects: You must run lint only on the TOP-MOST module in order to avoid duplicate/false lint warnings. Running lint on the top-most module will run lint on all of the lower modules as well. You must then run pmd and findBugs separately on each lower module in order to get complete coverage. So for example, if you have an app that depends on libraryOne and libraryTwo, to get complete coverage you must run something similar to `./gradlew app:analyzeDebug libraryOne:pmd libraryOne:findBugsDebug libraryTwo:pmd libraryTwo:findBugsDebug`\n\n### Plugin Details\nHere's a detailed list of changes/additions that Static Analysis Gradle Plugin made to the associated plugins:\n\n#### PMD\n* Sets the default source files to those that are typical in Android projects\n* Changes the default `ignoreFailures` to true\n* Sets a default `ruleSetFile`\n* Enables xml and html reporting\n\n#### FindBugs\n* Creates Gradle task for each of build variants and ensures that these tasks are run after the assembleVariant tasks\n* Sets the default source files and classes to those that are typical in Android projects\n* Changes the default `effort` to max\n* Changes the default `ignoreFailures` to true\n* Sets a default `excludeFilter`\n* Enables xml and html reporting\n\n#### Android Lint\n* Changes the default `abortOnError` flag to false\n* If one does not already exist, this will generate a [`lint.xml`](src/main/resources/default-lintConfig.xml) file in the project containing the standard rules so we have a common set of checks across all projects.\n* Creates `updateLintFile` gradle task to manually update the project's `lint.xml` to match the library's version.\n\n### Configuration\nThe following configurations can be set in the app `build.gradle` to override the default behaviors:\n\n```\nstaticAnalysis {\n    pmdVersion              // default:  \"5.5.1\"\n    findbugsVersion         // default:  \"3.0.1\"\n\n    source                  // default:  \"src\"\n    include                 // default:  \"**/*.java\"\n    exclude                 // default:  \"**/gen/**\"\n\n    pmdRuleSetFile\n\n    findBugsEffort          // default:  \"max\"\n    findBugsReportLevel     // default:  \"medium\"\n    findBugsClasses         // default:  files(\"${project.buildDir}/intermediates/classes\")\n    findBugsExcludeFilterFile\n\n    lintAbortOnError        // default:  true\n    lintCheckDependencies   // default:  true\n    lintWarningsAsErrors    // default:  true\n}\n```\n\u003cb\u003ePlease note that if you want to change any of the settings referenced here (such as lint's `abortOnError`) you'll need to do it via this configuration block, since this plugin will overwrite the same properties you set directly in the `lintOptions`, `findbugs`, or `pmd` block(s) of your build.gradle file.\u003c/b\u003e\n\nRefer to the gradle doc for [PmdExtension](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.PmdExtension.html) and [FindBugsExtension](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.FindBugsExtension.html) for an explaination of these fields.\n\nThe default `pmdRuleSetFile`, `findBugsExcludeFilterFile`, and `lintConfig` files can be found [here](src/main/resources).\n\nSince the library automatically creates `lint.xml` and provides `updateLintFile` gradle task to update it, **projects should not manually modify their `lint.xml`.** Instead, use the `lintOptions` gradle block to override specific rules. For example:\n```\nlintOptions {\n    ignore \"ContentDescription\", \"SelectableText\"\n    warning \"SwitchIntDef\"\n} \n```\n### Publishing\nThis project is set to publish to the [Gradle plugins repository](https://plugins.gradle.org/). To publish an update to the plugin, add the following lines to the `gradle.properties` file (either the one in the project directory or `~/.gradle/gradle.properties`):\n```\ngradle.publish.key=#######\ngradle.publish.secret=#######\n```\nand then run `./gradlew publishPlugins`\n\nThe key and secret can also be added by running `./gradlew login` command\n\n### License\n```\nCopyright 2017 Intrepid Pursuits LLC.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidpursuits%2Fstatic-analysis-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintrepidpursuits%2Fstatic-analysis-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidpursuits%2Fstatic-analysis-gradle-plugin/lists"}