Skip to content

Conversation

@Pankraz76
Copy link
Contributor

@Pankraz76 Pankraz76 commented Oct 21, 2025

ReturnValueIgnored:

  Did you mean 'final class EncodingTest extends GradleIntegrationHarness {'?
/Users/vincent.potucek/IdeaProjects/spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/EncodingTest.java:54: error: [ReturnValueIgnored] Return value of 'contains' must be used
                gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!");
                                                                                                 ^
    (see https://errorprone.info/bugpattern/ReturnValueIgnored)
  Did you mean 'assertThat(gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!")).isTrue();' or 'var unused = gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!");' or to remove this line?
/Users/vincent.potucek/IdeaProjects/spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/EncodingTest.java:78: error: [ReturnValueIgnored] Return value of 'contains' must be used
                gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!");
                                                                                                 ^
    (see https://errorprone.info/bugpattern/ReturnValueIgnored)
  Did you mean 'assertThat(gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!")).isTrue();' or 'var unused = gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!");' or to remove this line?

@Pankraz76 Pankraz76 changed the title [prone] Apply UnusedMethod [prone] Apply Unused Oct 21, 2025
@Pankraz76 Pankraz76 force-pushed the pr-fix-UnusedMethod branch 2 times, most recently from e0be7f1 to 1a3e9fc Compare October 21, 2025 18:55
'Slf4jLogStatement',
'MissingSummary',
// patchable
'LexicographicalAnnotationAttributeListing',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now its working as we have enabled convention. the warnings does not break the build somehow.

'NonStaticImport',
'Slf4jLoggerDeclaration', // logger -> log
'StaticImport',
// critical, finds lots of bugs... unused configs and stuff.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much risk and too big. Some extension maven stuff might be unused in code but break on production.

@Pankraz76 Pankraz76 force-pushed the pr-fix-UnusedMethod branch 2 times, most recently from bab19d1 to 104ac8c Compare October 21, 2025 19:02
@Pankraz76 Pankraz76 marked this pull request as ready for review October 21, 2025 19:03
@Pankraz76 Pankraz76 force-pushed the pr-fix-UnusedMethod branch from 104ac8c to aff83f8 Compare October 22, 2025 11:32
@Pankraz76 Pankraz76 changed the title [prone] Apply Unused [prone] Apply UnnecessaryLambda Oct 22, 2025
@Pankraz76 Pankraz76 force-pushed the pr-fix-UnusedMethod branch from aff83f8 to 1780080 Compare October 22, 2025 11:46
" encoding 'US-ASCII'",
"}");
setFile("test.java").toContent("µ");
gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput().contains("Encoding error!");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use or loose. Should we check this or adapt the test by removing or inverting this?

Should we extract the ReturnValueIgnored recipe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am baffled by this one. The old test was wrong, but the new one looks wrong too. It would be nice to make this test better while we're in here, but I don't want it to hold up the rest.

@Pankraz76 Pankraz76 force-pushed the pr-fix-UnusedMethod branch from bf59f74 to adb2dd3 Compare October 23, 2025 08:40
@nedtwigg nedtwigg merged commit a0ac600 into diffplug:main Oct 23, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants