-
Notifications
You must be signed in to change notification settings - Fork 14.9k
MINOR: Add RemoveUnusedPrivateMethods #21165 #21168 #21149
#21269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
26dd3a6 to
79f258a
Compare
config/sanity.yml
Outdated
| displayName: Apply all common best practices | ||
| description: Comprehensive code quality recipe combining modernization, security, and best practices. | ||
| recipeList: | ||
| - org.openrewrite.staticanalysis.InlineVariable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kindly asking, if this is any good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have any experience of this. My view is that a PR which makes changes to the build should contain just those changes and you would need to convince a committer familiar with the build process that it was a worthwhile change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's also a simple way to merge: activating the recipes after the merge.
Still, it's hard for me to believe that this will be merged without knowing upfront what it's doing and what the benefits are. This is the same task all the SCA tools have, so there are many ways to integrate. Of course, a small and simple approach is in my favor as well.
| - org.openrewrite.staticanalysis.InlineVariable | ||
| # - org.openrewrite.staticanalysis.CommonStaticAnalysis # composition for -> NoDoubleBraceInitialization | ||
| # - org.openrewrite.staticanalysis.EqualsAvoidsNull | ||
| # - org.openrewrite.staticanalysis.NoDoubleBraceInitialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this could be handled next as also encountered in:
| ./gradlew spotlessApply | ||
|
|
||
| #### Rewrite | ||
| The build system incorporates [Moderne](https://moderne.io/) rewrite capabilities for automated code transformations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it's not fully automated—it just fails the build when it detects problematic code, which is exactly what everyone wants to see.
Just like Error Prone offers patching, Rewrite does too. That's a good thing, because it saves time on trivial fixes that the tool can handle automatically.
Still, it's up to each developer to apply and verify the changes themselves. It's simply an optional tool (run), not a requirement.
As long as the code is complain in the end, Rewrite is satisfied. How you get there is up to each individual.
sounds not desirable to me personally
Also im wondering about this argument in the presents of spotless. This tool is all about automating stuff and patching. So its actually nothing new, just covers the most issues as well, but can got beyond as well, making it some consideration.
...nts-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java
Outdated
Show resolved
Hide resolved
…che#21149 Signed-off-by: Vincent Potucek <[email protected]>
79f258a to
2082e8a
Compare
|
adjusted to |
InlineVariable #21165 #21168 #21149 [RSPEC-S1488]RemoveUnusedPrivateMethods #21165 #21168 #21149 [RSPEC-S1488]
|
#21168's checks already exist as checkstyle's AvoidDoubleBraceInitialization and spotbugs' UPM_UNCALLED_PRIVATE_METHOD. It looks like your goal here is to introduce openrewrite as a whole rather than add any particular check. The project already runs checkstyle for linting and spotbugs for static analysis. I do not think it makes sense to add a second linting and static analysis pass because of the overlap in functionality. If the proposal is to replace checkstyle and spotbugs with openrewrite, we should discuss that. |
Spot on. +1. |
No, that's not the goal. All the tools have their individual benefit. Even on one and the same issue like this, having a layered stack of Checkstyle, Spotless, SpotBugs, PMD, and Error Prone, Rewrite still finds some methods that all other tools don't. (That's actually the Checkstyle stack, so this is a real-world example.) So it's about having redundancy in critical infrastructure. BTW: Thats something Germany seems not been capable of, like recently seen. Also, each tool has its dedicated features, like Java migration as an example: It's not about talking good or bad about any other tool. It's just about getting the job done on the unused method stuff, then considering that—beyond recipes—each offers individual benefit again. So the discussion should be simple in this regard, as it's "only" a new tool solving an already applied convention. |
RemoveUnusedPrivateMethods #21165 #21168 #21149 [RSPEC-S1488]RemoveUnusedPrivateMethods #21165 #21168 #21149
|
We can learn from Spotless that it seems acceptable to have this tool, as they asked to put an accidentally deleted rule back in. From Checkstyle, we can learn that redundancy alone may not be enough — over time, surprising issues can arise, as usually expected. Relying on a single point of failure — putting all your eggs in one basket — goes against common system design principles. |
MINOR: Add
RemoveUnusedPrivateMethods#21165 #21168 #21149According to: