Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- `removeSemicolons()` no longer removes semicolons inside dollar-slashy strings (`$/ ... /$`), after escaped triple quotes in multiline strings, or in multi-line `for (init; cond; update)` headers. ([#2780](https://github.com/diffplug/spotless/issues/2780))
- `removeUnusedImports()` and `googleJavaFormat()` no longer remove imports that are only used by links in Markdown doc comments (`///`, JDK 23+). ([#3161](https://github.com/diffplug/spotless/issues/3161))
- `forbidWildcardImports` no longer reports import statements inside Java text blocks or comments. ([#2997](https://github.com/diffplug/spotless/issues/2997))
- `spotlessCheck` no longer fails with `There were 0 lint error(s)` when `spotless-clean` only contains stale files which already match the source on disk. ([#2992](https://github.com/diffplug/spotless/issues/2992))

## [8.11.0] - 2026-11-02
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ private void performAction(boolean isTest) throws IOException {
getEncoding().get())
.problemFiles(unformattedFiles)
.getMessage());
} else {
} else if (!lintsFiles.isEmpty()) {
// We only show lints if there are no unformatted files.
// This is because lint line numbers are relative to the
// formatted content, and formatting often fixes lints.
boolean detailed = false;
throw new GradleException(super.allLintsErrorMsgDetailed(lintsFiles, detailed));
} else {
// the clean files are stale copies of what is already on disk (see getUncleanFiles)
getState().setDidWork(sourceDidWork());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2025 DiffPlug
* Copyright 2016-2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -170,6 +170,17 @@ void paddedCellApplyCheck() throws Exception {
diverge.check();
}

@Test
void checkPassesWhenCleanFileMatchesDisk() throws Exception {
Bundle wellbehaved = wellbehaved();
wellbehaved.format();
setFile("src/test.wellbehaved").toContent("42");
assertFile(wellbehaved.outputFile.get()).hasContent("42");

// a stale clean file without lints must not fail the check (#2992)
wellbehaved.check.get().performActionTest();
}

@Test
void diagnose() throws Exception {
wellbehaved().diagnose();
Expand Down
Loading