diff --git a/gradle/special-tests.gradle b/gradle/special-tests.gradle index 1931043e42..c4c5544378 100644 --- a/gradle/special-tests.gradle +++ b/gradle/special-tests.gradle @@ -14,9 +14,11 @@ def special = [ boolean isCiServer = System.getenv().containsKey("CI") tasks.withType(Test).configureEach { if (isCiServer) { - retry { - maxRetries = 2 - maxFailures = 10 + develocity { + testRetry { + maxRetries = 2 + maxFailures = 10 + } } } // selfie https://selfie.dev/jvm/get-started#gradle diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index a3ec793bc2..5ea29c04e6 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -10,6 +10,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `google-java-format` version to latest `1.24.0` -> `1.28.0`. ([#2345](https://github.com/diffplug/spotless/pull/2345)) * Bump default `ktlint` version to latest `1.5.0` -> `1.7.1`. ([#2555](https://github.com/diffplug/spotless/pull/2555)) * Bump default `jackson` version to latest `2.19.2` -> `2.20.0`. ([#2606](https://github.com/diffplug/spotless/pull/2606)) +* Running `spotlessCheck` with violations unilaterally produces the error message `Run './gradlew spotlessApply' to fix these violations`. ([#2592](https://github.com/diffplug/spotless/issues/2592)) ### Fixed * Respect system gitconfig when performing git operations ([#2404](https://github.com/diffplug/spotless/issues/2404)) diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java index 175a828a66..fdc93ce04a 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java @@ -138,12 +138,7 @@ void init(SpotlessTaskImpl impl) { getProjectPath().set(getProject().getPath()); getEncoding().set(impl.getEncoding()); getRunToFixMessage().convention( - "Run '" + calculateGradleCommand() + " " + getTaskPathPrefix() + "spotlessApply' to fix these violations."); - } - - private String getTaskPathPrefix() { - String path = getProjectPath().get(); - return path.equals(":") ? ":" : path + ":"; + "Run '" + calculateGradleCommand() + " spotlessApply' to fix all violations."); } private static String calculateGradleCommand() { diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/DiffMessageFormatterTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/DiffMessageFormatterTest.java index 24b2a8504d..95f428fc00 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/DiffMessageFormatterTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/DiffMessageFormatterTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,8 +117,8 @@ private void assertCheckFailure(Bundle spotless, String... expectedLines) throws } static final String EXPECTED_RUN_SPOTLESS_APPLY_SUGGESTION = FileSignature.machineIsWin() - ? "Run 'gradlew.bat :spotlessApply' to fix these violations." - : "Run './gradlew :spotlessApply' to fix these violations."; + ? "Run 'gradlew.bat spotlessApply' to fix all violations." + : "Run './gradlew spotlessApply' to fix all violations."; @Test void lineEndingProblem() throws Exception {