`ConstantNaming` not applied
It seems that RedundantStringConversion somehow is one of the few one always to be applied, but non of the others root checks.
- https://github.com/Pankraz76/spring-boot/pull/1
- https://github.com/Pankraz76/spring-framework/pull/2
Others like UnusedMethod, UnusedVariable and many more does not get applied despite it, the log shoes a Did you mean message, considering its patchable.
I can also confirm that sometimes the plugin like methods and stuff apply a lot by patching, until it fails to patch giving not the considered fix upfront.
config:
import static java.lang.System.getenv
apply plugin: 'net.ltgt.errorprone'
dependencies {
errorprone('com.google.errorprone:error_prone_core:2.42.0')
errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.25.0')
constraints {
errorprone('com.google.guava:guava') {
version {
require('33.4.8-jre')
}
because('Older versions use deprecated methods in sun.misc.Unsafe')
// https://github.com/junit-team/junit-framework/pull/5039#discussion_r2414490581
}
}
}
tasks.withType(JavaCompile).configureEach {
options.errorprone {
disableAllChecks = true // consider removal to avoid error prone error´s, following convention over configuration.
error('RedundantStringConversion')
error('UnusedMethod')
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
errorproneArgs.addAll(
'-XepPatchLocation:IN_PLACE',
'-XepPatchChecks:UnusedMethod'
)
}
}
}
> Compilation failed; see the compiler output below.
/Users/vincent.potucek/IdeaProjects/spring-boot/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ExportedImageTar.java:273: warning: [UnusedVariable] The parameter 'tarFile' is never read.
ManifestLayerArchiveFactory(Path tarFile, ImageArchiveManifest manifest) {
^
(see https://errorprone.info/bugpattern/UnusedVariable)
Did you mean 'ManifestLayerArchiveFactory(ImageArchiveManifest manifest) {'?
- https://github.com/spring-projects/spring-boot/pull/47694
Describe the bug
- [ ] I have verified that the issue is reproducible against the latest version of the project.
- [ ] I have searched through existing issues to verify that this issue is not already known.
Minimal Reproducible Example
- https://github.com/diffplug/spotless/pull/2687
- https://github.com/Pankraz76/junit5/pull/12
- https://github.com/PicnicSupermarket/error-prone-support/issues/1923
Its just the same code but does not apply on junit.
If applicable and possible, please replace this section with the code that
triggered the isue.
Logs
Please replace this sentence with log output, if applicable.
Expected behavior
Setup
- Operating system (e.g. MacOS Monterey).
- Java version (i.e.
java --version, e.g.17.0.16). - Error Prone version (e.g.
2.41.0). - Error Prone Support version (e.g.
0.24.0).
Additional context
Sorry, I'm afraid I don't follow the issue here. Could you describe the situation, what the actual behaviour is, and what the expected behaviour is?
basically the attached config works mostly not, actually just in spotless im able to apply the patching as expected for ALL checks.
In every other project its just failing, despite having only change the check from RedundantStringConversion to ConstantNaming or some other check is very likely just to fail the build like the IN_PATCH mode would not be activated or recognized.
So long story short why is it only RedundantStringConversion to be patchable?
It would be helpful to have a more minimal reproducible example, for example a small self-contained example using the Error Prone CLI (https://errorprone.info/docs/installation#command-line)