-
Notifications
You must be signed in to change notification settings - Fork 747
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
RemoveUnusedImports is not working #1893
Comments
I think you also need The following simple example works for me:
|
Hey @cushon Even after adding this property i could not see removal of unused imports. I could also see piranha is not working if i add this. We are integrating this with our micro-service which uses maven for build. |
I think I should have suggested If |
Thanks @cushon this option worked for me. The only challenge is it is taking 2 passes
|
I think that's WAI: Error Prone checks run in parallel, they can't 'see' the code after it has been refactored by other checks. To use (FWIW, the approach we use for cleaning up imports is to do that separately after applying fixes with a formatter.) |
Description of the problem / feature request:
We are planning to use errorprone with our service. We have a challenge with respect to removal of unused imports.
Feature requests: what underlying problem are you trying to solve with this feature?
We want to use RemoveUnusedImports feature from ErrorProne. These are our pom.xml arguments. Even after the build the unused import are not removed.
<arg>-Xplugin:ErrorProne -XepDisableAllChecks -Xep:RemoveUnusedImports -Xep:Piranha:WARN -XepPatchChecks:Piranha -XepPatchLocation:IN_PLACE -XepOpt:Piranha:FlagName=${SAMPLE_STALE_FLAG} -XepOpt:Piranha:IsTreated=true -XepOpt:Piranha:Config=${project.basedir}/src/main/resources/config/pirahana.json</arg>
`We tried on a vanilla spring boot application as well we are not seeing the removal of the unused import. We tried with the option of
-Xep:RemoveUnusedImports:ERROR
it is showing compilation error for unused import. These are the pluginInfo which we tried<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId<version>3.8.0</version><configuration><source>8</source><target>8</target><compilerArgs><arg>-XDcompilePolicy=simple</arg><arg>-Xplugin:ErrorProne -Xep:RemoveUnusedImports:ERROR</arg></compilerArgs><annotationProcessorPaths><path><groupId>com.google.errorprone</groupId><artifactId>error_prone_core</artifactId><version>2.4.0</version></path></annotationProcessorPaths></configuration></plugin>
What version of Error Prone are you using?
2.4.0
Have you found anything relevant by searching the web?
http://errorprone.info/docs/flags
The text was updated successfully, but these errors were encountered: