-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Apply RemoveUnusedImports
#132976
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
Apply RemoveUnusedImports
#132976
Conversation
| import org.apache.lucene.util.BytesRef; | ||
| import org.elasticsearch.common.util.*; | ||
| import org.elasticsearch.compute.data.*; | ||
| import org.openjdk.jmh.annotations.*; |
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.
re run actually it will resolve all wildcard imports.
|
We already have a rule forbidding unused imports. It seems as if it needs adjusting for these cases (excluding the generated code, we don't care about unused imports there). Definitely no need to take on all the work of adopting another static analysis tool just to do this tho. I'm closing this because I see that you're spamming the same sort of change across several unrelated projects on Github, but if you'd like to combine this change with adjustments to the Spotless config to prevent similar issues in future then please open a fresh PR to do that. |
can not handle wildcard import, it just a text parser, therefore considerer second class, PMD and rewrite both type aware. |
Sure, but wildcard imports are forbidden by other rules in this codebase. Clearly those rules aren't being applied everywhere, and we'd welcome a PR from you to fix up this misconfiguration. |
|
Yes, but even if the config is there, how to fix all the wildcards if not with rewrite? I'm not going to "spend" time on this. Of course, I could run the plugin locally and commit the changes, but that's considered cheating—taking the changes, but not the plugin doing so. Im only doing it the right way, in order not to waste our time. As its not only about wildcards assuming security fixes done by file recipe are something important for elastic as well: |
|
Assuming Spotless is broken because the convention-over-configuration principle wasn't properly implemented. |
|
No need to assume anything - if you'd like to open a PR to fix the Spotless config then that'd be very welcome, but if not then that's also fine. Either way, there's nothing more to discuss here so I'm locking this conversation. |
enabler for:
rewritesupport forRemoveUnusedImports#131611gradle check?