Upgrade checkstyle and spotbugs tooling#2699
Upgrade checkstyle and spotbugs tooling#26998Keep wants to merge 1 commit intojMonkeyEngine:masterfrom
Conversation
| onlyIf { gradle.rootProject.hasProperty('signingKey') } | ||
| } | ||
|
|
||
| def checkstyleSupported = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21) |
There was a problem hiding this comment.
New version of checkstyle requires jdk 21+.
There was a problem hiding this comment.
Code Review
This pull request updates the versions for Checkstyle and Spotbugs and adjusts their task configurations, including a transition from 'enabled' to 'required' for Spotbugs reports. It also introduces a Java version check to conditionally enable Checkstyle tasks. Feedback suggests that the Java 21 requirement is too restrictive and potentially incompatible with older Gradle versions, recommending a baseline of Java 17 instead. Furthermore, it is recommended to apply a similar version guard to Spotbugs tasks to prevent build failures on older JDKs.
| tasks.withType(com.github.spotbugs.snom.SpotBugsTask ) { | ||
| reports { | ||
| html.enabled = !project.hasProperty("xml-reports") | ||
| xml.enabled = project.hasProperty("xml-reports") | ||
| html.required = !project.hasProperty("xml-reports") | ||
| xml.required = project.hasProperty("xml-reports") | ||
| } | ||
| } |
There was a problem hiding this comment.
The Spotbugs tasks are not guarded by a Java version check, unlike the Checkstyle tasks in common.gradle. Since Spotbugs 4.8+ and its Gradle plugin 6.x require at least Java 17, running these tasks on older JDKs will cause the build to fail. Adding an enabled check ensures the tasks are skipped gracefully on unsupported environments, which aligns with the "non-blocking" goal stated in the PR description.
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
enabled = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)
reports {
html.required = !project.hasProperty("xml-reports")
xml.required = project.hasProperty("xml-reports")
}
}
Uh oh!
There was an error while loading. Please reload this page.