Skip to content
Open
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
10 changes: 6 additions & 4 deletions lib/src/main/java/com/diffplug/spotless/generic/IdeaStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ private static String resolveFullBinaryPathAndCheckVersion(String binaryPath) {
.pathToExe(pathToExe(binaryPath))
.versionRegex(Pattern.compile("(IntelliJ IDEA) .*"))
.fixCantFind(
"IDEA executable cannot be found on your machine, "
+ "please install it and put idea binary to PATH, provide a valid path to the executable or report the problem")
.fixWrongVersion("Provided binary is not IDEA, "
+ "please check it and fix the problem; or report the problem");
"""
IDEA executable cannot be found on your machine, \
please install it and put idea binary to PATH, provide a valid path to the executable or report the problem""")
.fixWrongVersion("""
Provided binary is not IDEA, \
please check it and fix the problem; or report the problem""");
try {
return exe.confirmVersionAndGetAbsolutePath();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ public FormatterStep create() {
}

private RoundtripState createRountrip() throws IOException, InterruptedException {
String howToInstall = "gofmt is a part of standard go distribution. If spotless can't discover it automatically, "
+ "you can point Spotless to the go binary with {@code pathToExe('/path/to/go')}";
String howToInstall = """
gofmt is a part of standard go distribution. If spotless can't discover it automatically, \
you can point Spotless to the go binary with {@code pathToExe('/path/to/go')}\
""";
final ForeignExe exe = ForeignExe.nameAndVersion("go", version)
.pathToExe(pathToExe)
.versionFlag("version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
logger.warn("{}({},{}): {}", this.filePath, line, col, message);
} else {
if ("warning".equals(severity)) {
logger.error("Formatter fails because of a parser warning. To make the formatter succeed in"
+ "the presence of warnings, set the configuration parameter 'failOnWarning' to 'false' (default: 'true')");
logger.error("""
Formatter fails because of a parser warning. To make the formatter succeed in\
the presence of warnings, set the configuration parameter 'failOnWarning' to 'false' (default: 'true')""");
}
throw new RuntimeException(
"line %d, col %d: %s (severity: %s)".formatted(line, col, message, severity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ private static Provisioner forConfigurationContainer(Project project, Configurat
projName = projName + "/";
}
throw new GradleException(String.format(
"You need to add a repository containing the '%s' artifact in '%sbuild.gradle'.%n"
+ "E.g.: 'repositories { mavenCentral() }'",
"""
You need to add a repository containing the '%s' artifact in '%sbuild.gradle'.%n\
E.g.: 'repositories { mavenCentral() }'""",
mavenCoords, projName), e);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ void targetExcludeIfContentContainsWithMultipleSteps() throws IOException {
" target '**/*.md'",
" targetExcludeIfContentContains '// Generated by Mr. Roboto'",
" custom 'lowercase', { str -> str.toLowerCase() }",
" licenseHeader('" + "// My CopyRights header" + "', '--')",
"""
licenseHeader('\
// My CopyRights header\
', '--')""",
" }",
"}");
String generatedContent = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,13 @@ void gitAttributes() throws IOException {
if (Jvm.version() >= 16) {
// for GJF https://github.com/diffplug/spotless/issues/834
setFile(".mvn/jvm.config").toContent(
"--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
+ " --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"
+ " --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"
+ " --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"
+ " --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
// this last line is for Detekt
+ // this last line is for Detekt
" --add-opens java.base/java.lang=ALL-UNNAMED");
"""
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED\
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED\
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED\
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED\
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED\
--add-opens java.base/java.lang=ALL-UNNAMED""");
}
// copy the mvnw resources
copy("mvnw").setExecutable(true);
Expand Down
18 changes: 2 additions & 16 deletions rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ recipeList:
- org.openrewrite.java.format.NormalizeLineBreaks
- org.openrewrite.java.format.RemoveTrailingWhitespace
- org.openrewrite.java.migrate.UpgradeToJava17
- org.openrewrite.java.migrate.lang.UseTextBlocks
- org.openrewrite.java.migrate.util.JavaUtilAPIs
- org.openrewrite.java.migrate.util.MigrateInflaterDeflaterToClose
- org.openrewrite.java.migrate.util.ReplaceStreamCollectWithToList
Expand Down Expand Up @@ -68,22 +69,7 @@ styleConfigs:
- org.openrewrite.java.style.ImportLayoutStyle:
classCountToUseStarImport: 999
nameCountToUseStarImport: 999
# bug https://github.com/openrewrite/rewrite/issues/6107
# layout:
# - import java.*
# - <blank line>
# - import javax.*
# - <blank line>
# - import org.*
# - <blank line>
# - import com.*
# - <blank line>
# - import com.diffplug.*
# - <blank line>
# - import static all other imports
# - <blank line>
# - import all other imports
# - <blank line>
# no layout needed, we use spotless
- org.openrewrite.java.style.TabsAndIndentsStyle:
useTabCharacter: true
tabSize: 4
Expand Down
Loading