-
Notifications
You must be signed in to change notification settings - Fork 459
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
spotless:off and spotless:on fails to prevent changes to imports #996
Comments
That's surprising, I would expect this to work. The step order shouldn't matter at all: spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java Lines 725 to 734 in 23249fc
I think we'd need a test repo to help. Just a guess - maybe these files are being accidentally formatted by two different subprojects, and one of them has |
Ah, so that problem was my mistake - I set
I've tried to create a minimal reproduction of this issue in a project that I can make public without success. I also get the same error when using |
FWIW, I get this with spotless 5.14.0 and 6.0.0, Java 15, 16 and 17 (didn't try with lower JDK's) and Gradle 7.0, 7.1, 7.2 and 7.3 on macOS. |
Check out the "limitations" section here, #691 If you comment out the toggleOffOn, I think you'll find that the toggle tags are getting removed. You'll need to isolate which step is doing that, and put the tags somewhere that they won't get removed. |
Yep. Still can’t reproduce in a different project. Not sure what components are interacting to cause. Worked around by just using the full import to PMD so no need to worry about spotless removing the ‘// NOPMD’. |
Running
./gradlew :spotlessApply
on the following snippet:Results in the following, which causes my PMD to fail with unused imports error:
I'd expect no changes to those 3 lines of code.
Config block:
The text was updated successfully, but these errors were encountered: