Skip to content

Commit ed0d468

Browse files
authored
State ./gradlew spotlessApply fixes all issues in error message (#2593 closes #2592)
2 parents 3f8a35a + 7b89f83 commit ed0d468

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

gradle/special-tests.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def special = [
1414
boolean isCiServer = System.getenv().containsKey("CI")
1515
tasks.withType(Test).configureEach {
1616
if (isCiServer) {
17-
retry {
18-
maxRetries = 2
19-
maxFailures = 10
17+
develocity {
18+
testRetry {
19+
maxRetries = 2
20+
maxFailures = 10
21+
}
2022
}
2123
}
2224
// selfie https://selfie.dev/jvm/get-started#gradle

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1010
* Bump default `google-java-format` version to latest `1.24.0` -> `1.28.0`. ([#2345](https://github.com/diffplug/spotless/pull/2345))
1111
* Bump default `ktlint` version to latest `1.5.0` -> `1.7.1`. ([#2555](https://github.com/diffplug/spotless/pull/2555))
1212
* Bump default `jackson` version to latest `2.19.2` -> `2.20.0`. ([#2606](https://github.com/diffplug/spotless/pull/2606))
13+
* Running `spotlessCheck` with violations unilaterally produces the error message `Run './gradlew spotlessApply' to fix these violations`. ([#2592](https://github.com/diffplug/spotless/issues/2592))
1314
### Fixed
1415
* Respect system gitconfig when performing git operations ([#2404](https://github.com/diffplug/spotless/issues/2404))
1516

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,7 @@ void init(SpotlessTaskImpl impl) {
138138
getProjectPath().set(getProject().getPath());
139139
getEncoding().set(impl.getEncoding());
140140
getRunToFixMessage().convention(
141-
"Run '" + calculateGradleCommand() + " " + getTaskPathPrefix() + "spotlessApply' to fix these violations.");
142-
}
143-
144-
private String getTaskPathPrefix() {
145-
String path = getProjectPath().get();
146-
return path.equals(":") ? ":" : path + ":";
141+
"Run '" + calculateGradleCommand() + " spotlessApply' to fix all violations.");
147142
}
148143

149144
private static String calculateGradleCommand() {

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/DiffMessageFormatterTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,8 +117,8 @@ private void assertCheckFailure(Bundle spotless, String... expectedLines) throws
117117
}
118118

119119
static final String EXPECTED_RUN_SPOTLESS_APPLY_SUGGESTION = FileSignature.machineIsWin()
120-
? "Run 'gradlew.bat :spotlessApply' to fix these violations."
121-
: "Run './gradlew :spotlessApply' to fix these violations.";
120+
? "Run 'gradlew.bat spotlessApply' to fix all violations."
121+
: "Run './gradlew spotlessApply' to fix all violations.";
122122

123123
@Test
124124
void lineEndingProblem() throws Exception {

0 commit comments

Comments
 (0)