[build] Upgrade to spotbugs Gradle plugin 6.0.2 (#6027)

This commit is contained in:
Tyler Veness
2023-12-09 15:34:29 -08:00
committed by GitHub
parent 7bfadf32e5
commit d40bdd70ba
3 changed files with 86 additions and 75 deletions

View File

@@ -1,83 +1,85 @@
if (!project.hasProperty('skipJavaFormat')) {
apply plugin: 'checkstyle'
if (project.hasProperty('skipJavaFormat')) {
return;
}
checkstyle {
toolVersion = "10.12.2"
configDirectory = file("${project.rootDir}/styleguide")
config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml"))
apply plugin: 'checkstyle'
checkstyle {
toolVersion = "10.12.2"
configDirectory = file("${project.rootDir}/styleguide")
config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml"))
}
apply plugin: 'pmd'
pmd {
toolVersion = '6.55.0'
consoleOutput = true
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files(new File(rootDir, "styleguide/pmd-ruleset.xml"))
ruleSets = []
}
apply plugin: 'com.diffplug.spotless'
spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**', '**/bin/**', "src/generated/**"
}
toggleOffOn()
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
apply plugin: 'pmd'
pmd {
toolVersion = '6.55.0'
consoleOutput = true
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files(new File(rootDir, "styleguide/pmd-ruleset.xml"))
ruleSets = []
groovyGradle {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
apply plugin: 'com.diffplug.spotless'
spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**', '**/bin/**', "src/generated/**"
}
toggleOffOn()
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
json {
target fileTree('.') {
include '**/*.json'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
exclude '**/simgui-ds.json', '**/simgui-window.json', '**/simgui.json', '**/networktables.json'
}
gson()
.indentWithSpaces(2)
}
format 'xml', {
target fileTree('.') {
include '**/*.xml'
exclude '**/build/**', '**/build-*/**', '**/bin/**', '**/.idea/**', '**/.run/**'
}
eclipseWtp('xml')
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
format 'misc', {
target fileTree('.') {
include '**/*.md', '**/.gitignore'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
}
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
json {
target fileTree('.') {
include '**/*.json'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
exclude '**/simgui-ds.json', '**/simgui-window.json', '**/simgui.json', '**/networktables.json'
}
gson()
.indentWithSpaces(2)
}
apply plugin: 'com.github.spotbugs'
spotbugs {
ignoreFailures = false
effort = 'max'
excludeFilter = file("${project.rootDir}/styleguide/spotbugs-exclude.xml")
format 'xml', {
target fileTree('.') {
include '**/*.xml'
exclude '**/build/**', '**/build-*/**', '**/bin/**', '**/.idea/**', '**/.run/**'
}
eclipseWtp('xml')
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
format 'misc', {
target fileTree('.') {
include '**/*.md', '**/.gitignore'
exclude '**/build/**', '**/build-*/**', '**/bin/**'
}
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
}
apply plugin: 'com.github.spotbugs'
spotbugs {
ignoreFailures = false
effort = spotbugsEffort
excludeFilter = file("${project.rootDir}/styleguide/spotbugs-exclude.xml")
}
task javaFormat {