-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Add rewrite
support for errorprone.refasterrules.FileRulesRecipes
#20219
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
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.
outdated dependencies.
3f6ade4
to
4564214
Compare
Kindly request your feedback. Thanks for consideration. Is this is any good? @m1a2st |
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.
The PR is marked as "[Experimental]" but makes changes that would affect all developers immediately. This includes modifying the main build configuration, adding new required tasks to the check lifecycle, enabling build caching globally, and changing existing tool configurations. For an experimental feature, I'd suggest using a separate build file or opt-in flag instead. It would also be helpful to create a feature branch for testing, provide a way to disable the rewrite checks, and add proper documentation about the experimental nature of these changes.
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.
Both Spotless and Rewrite are configured to handle imports: Spotless has importOrder() configuration and Rewrite has RemoveUnusedImports recipe active.
This creates overlapping responsibilities and potential conflicts. Consider either:
- Using only Spotless for formatting/imports and Rewrite for code cleanup
- Disabling import handling in one of the tools
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, thanks for pointing out.
Indeed, Rewrite has the ability to take over, making Spot and Check obsolete, considering the recipe:
As a potential migration is too much for now, this PR is considered kind of PoC.
The import case is a good example - Rewrite has also bugs of course, but in this case seems to be stronger due to the type awareness.
Assuming Spot (which uses Google's formatter) is just a simple file parser like Checkstyle, it has a lot of blind spots in the unused imports theme again.
2. Disabling import handling in one of the tools
yes shifted from spot to rewrite demonstrating the leftovers.
- Using only Spotless for formatting/imports and Rewrite for code cleanup
yes thats the goal to later on check if spot is still necessary.
But first start small then continue.
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.
Thanks for clarifying. I agree that starting small is better. Since you're demonstrating Rewrite's capabilities as a PoC, I suggest you to document in the PR description that this is exploring Rewrite as a potential Spotless replacement. For now, you can explicitly disable import handling in Spotless to avoid conflicts. Consider creating a follow-up issue to track the full migration evaluation.
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerTest.java
Outdated
Show resolved
Hide resolved
Maybe It needs to be wanted and pulled by the dev team, as it's a conventional change, not designed to opt in, as the nature of this can be (once) invasive and is meant to sustain therefore be constantly checked against. Same approach like spot but more flexible. I would suggest to make a decision about using the potential benefit this tool has to offer and then integrate it non-breaking/colliding with anything of course, making it ready (opt-in/out) to be removed afterwards again, if it turns out, not to be practical. The import statement is a good starter and the removals as they should flag only once and non-critical stuff as overhead is normally obsolete, ready to be reconsidered and resolved. As the task is meant to run in cloud only it's about time and stability, as the recipes are individual. |
rewrite
support for RemoveUnusedPrivateMethods
& RemoveUnusedImports
rewrite
support for RemoveUnusedPrivateMethods
& RemoveUnusedImports
rewrite
support for RemoveUnusedPrivateMethods
& RemoveUnusedImports
rewrite
support for errorprone.refasterrules.FileRulesRecipes
|
refs:
rewrite
support forRemoveUnusedPrivateMethods
&RemoveUnusedImports
opensearch-project/OpenSearch#18791rewrite
support forerrorprone.refasterrules.StringRulesRecipes
diffplug/spotless#2576The code seems to be out of sync considering the changes made when applying the config/convention:
(Assuming the version bump alone did not make these changes in the headers)
Also assuming that Java files currently have no header check besides Checkstyle. It seems considerable to have the Spot config in one place, giving it Separation of Concerns as well as Single Source of Truth.