Repository navigation
Conversation
…did not check (diffplug#3143) A file whose formatting does not converge is skipped with a warning, and spotlessCheck passes even though the file was never checked - in CI such a file is silently ungated (diffplug#3143). The new opt-in failOnNotConverging() makes the format task fail on such a file instead; the default behavior (warn + skip) is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3143
What is wrong
For a file whose formatting does not converge,
SpotlessTaskImplprintsSkipping '<path>' because it does not convergeand writes no output, andSpotlessCheckonly inspects the clean/lints output directories — so the skip is invisible to the check:spotlessCheckexits 0 for a file it did not check. In CI that file is silently ungated, and a formatter bump can turn a previously-formatted file non-convergent with no signal at all (green to green).Reproduction on current
main(before this change): acustomstep that appends a space never converges, andPaddedCellTaskTest's existingdiverge.check()succeeds. My RED probe test asserting the opposite failed on unmodifiedmain:What changed (opt-in, default behavior unchanged)
SpotlessTask: new@Inputboolean propertyfailOnNotConverging, defaultfalse.FormatExtension.failOnNotConverging(): opt-in DSL, forwarded to the format task insetupTask(covers every format type, since all typed extensions callsuper.setupTask).SpotlessTaskImpl.processInputFile: in the existingdidNotConvergebranch, an opted-in build now throws with a message pointing atspotlessDiagnose/ the flag; without the flag the warning-and-skip behavior is byte-for-byte what it was.plugin-gradle/README.md(+ TOC entry),CHANGES.mdentry.FailOnNotConvergingTest(end-to-end, Gradle TestKit) andPaddedCellTaskTest.failOnNotConvergingFailsCheck.Verification
RED (unmodified
main, before the change):7 tests completed, 1 failed— the probe asserting "check must fail for a non-converging file" failed, demonstrating the gap.GREEN (this change),
./gradlew :plugin-gradle:testover the targeted set:./gradlew :plugin-gradle:spotlessCheck(self-application incl. freshmark) and:plugin-gradle:javadocpass.What must NOT change
failOnNotConverging(), a non-converging file is still skipped with exactly the previous warning andspotlessCheckstill passes (FailOnNotConvergingTest.skipsByDefaultand the untouchedpaddedCellFormat/paddedCellApplyCheckpin this).libare untouched; this change is Gradle-plugin only (the Maven plugin tracks non-converging files in its own report, separate concern).spotlessDiagnose, the IDE hook, and ratcheting behavior are untouched.