Open pengcao1 opened 3 years ago
@pengcao1 I'm not sure we actually have one. I know most of us don't work on Android projects. But if someone does have an example, it would be great to submit a pull request!
I recently added SpotBugs to AntennaPod. See the commit here: https://github.com/AntennaPod/AntennaPod/commit/3946f986d723f8579a33140bbe3c0d95182ecab1
Basically, it's pretty straight-forward. In the commit above, I added some hacky printing tasks to be easier to use on CI but something like the following in the main ${root}build.gradle
should work:
buildscript {
dependencies {
...
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.0"
}
}
allprojects {
apply plugin: 'com.github.spotbugs'
spotbugs {
effort = 'max'
reportLevel = 'medium'
}
}
You can then run it using ./gradlew :app:spotbugsDebug
or (if you use build variants) ./gradlew :app:spotbugs[Variant]Debug
. AntennaPod uses multiple modules where some have variants and some don't. For that, we just execute ./gradlew spotbugs[Variant]Debug spotbugsDebug
to run the respective task for all modules automatically.
Hi everyone:
As you can see in the title, Could anyone can leave the demo of spotbugs used in the android project?
In my view, the official doc is obscure,
eg:
${root}build.gradle
${root}app/build.gradle