Repository navigation
chore(deps): update dependency com.puppycrawl.tools:checkstyle to v14 - #631
muntasir-396 wants to merge 1 commit into
Conversation
Remove obsolete FilteringWriteTag module from Checkstyle configuration as it is incompatible with Checkstyle 13+.
| <module name="ExplicitInitialization"/> | ||
|
|
||
| <!-- https://checkstyle.org/config_javadoc.html#WriteTag --> | ||
| <!-- https://gitlab.com/stellardrift/stylecheck/-/blob/dev/src/main/java/ca/stellardrift/stylecheck/FilteringWriteTag.java --> |
There was a problem hiding this comment.
Please review gradle config.
There likely extra dependency jar user , extra check is at extension of Checkstyle.
So it should stay.
We just need to find how to run validation of Checkstyle on this project by gradle
There was a problem hiding this comment.
@romani Thank you for the review!
I checked the Gradle configuration in build-logic/src/main/groovy/org.spongepowered.configurate.build.component.gradle, and stylecheck is indeed added to the classpath:
dependencies {
checkstyle(libs.stylecheck) // ca.stellardrift:stylecheck:0.2.1
}However, running ./gradlew checkstyleMain checkstyleTest with Checkstyle 14 and FilteringWriteTag present fails due to two breaking changes in Checkstyle 14:
-
tagSeverityproperty removed in Checkstyle 14 (Issue #21080):Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property 'tagSeverity' does not exist, please check the documentation -
Binary incompatibility in
ScopeUtil(Issue #13351):
Even after removingtagSeverity,ca.stellardrift:stylecheck:0.2.1(the latest release on Central, published May 2023) was compiled against Checkstyle 10.11.0. Checkstyle 14 changedScopeUtil.getSurroundingScope(DetailAST)return type fromScopetoOptional<Scope>, resulting in:Caused by: java.lang.NoSuchMethodError: 'com.puppycrawl.tools.checkstyle.api.Scope com.puppycrawl.tools.checkstyle.utils.ScopeUtil.getSurroundingScope(com.puppycrawl.tools.checkstyle.api.DetailAST)' at ca.stellardrift.stylecheck.FilteringWriteTag.visitToken(FilteringWriteTag.java:106) at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:382)
Since ca.stellardrift:stylecheck does not yet have a Checkstyle 14-compatible release, FilteringWriteTag cannot run under Checkstyle 14. When FilteringWriteTag is removed or commented out, ./gradlew checkstyleMain checkstyleTest completes with BUILD SUCCESSFUL across all modules.
Would you prefer:
- Leaving
FilteringWriteTagcommented out in.checkstyle/checkstyle.xmlwith a<!-- TODO: re-enable once stylecheck is updated for Checkstyle 14 -->comment, or - Keeping it removed as in the current diff?
There was a problem hiding this comment.
In checkstyle CI we should remove this Check.
At this PR, we should ask authors what is preferred, may be new WriteTag after big breaking changes that we already released is what they need.
There was a problem hiding this comment.
Do you see a functional reason why this FilteringWriteTag is required? In comparison to standard Checks
There was a problem hiding this comment.
@romani Yes, FilteringWriteTag adds two features that standard WriteTag lacks:
minimumScope="protected": Only enforces@sinceonpublicandprotectedAPI, ignoringprivateand package-private members (standardWriteTagflags all).ignoredAnnotations: Automatically skips@Overrideand@Testmethods.
Because of this, standard WriteTag would produce false positives across their private and overridden methods.
- Checkstyle CI: Already green because
FilteringWriteTagis removed on my branch. - Configurate PR: We can ask Configurate authors if they prefer commenting it out until
stylecheckupdates for v14, or removing it for now.
There was a problem hiding this comment.
In this PR please restore FilteringWriteTag and do update for stylecheck to use latest version of Checkstyle
There was a problem hiding this comment.
Oh, FilteringWriteTag has execution problems in latest checkstyle. We need mainters guidance and what is ok approach to move forward
There was a problem hiding this comment.
@zml2008, please share your thoughts on how to move forward?
Update Checkstyle dependency from
12.3.1to14.4.0.Also removes the obsolete
FilteringWriteTagmodule from.checkstyle/checkstyle.xml, which hadtagSeverity="ignore"and is incompatible with Checkstyle 13+ due toca.stellardrift:stylecheckcallingScopeUtil.getSurroundingScopewhose return type changed in Checkstyle 13.All Checkstyle tasks (
./gradlew checkstyleMain checkstyleTest) pass cleanly with 0 errors.This also allows Configurate to run cleanly against latest Checkstyle snapshots in Checkstyle regression test suite (checkstyle/checkstyle#22310).