Skip to content

Commit bf1d60a

Browse files
committed
More path sanitizing.
1 parent 4818acf commit bf1d60a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ protected StringSelfie expectSelfieErrorMsg(ProcessRunner.Result result) {
368368
String trimTrailingString = sanitizedVersion.substring(0, help1);
369369

370370
String sanitizeBiomeNative = trimTrailingString.replaceAll("spotless-data/biome/biome-(.+),", "biome-exe");
371-
String sanitizeFilePath = sanitizeBiomeNative.replaceAll(rootFolder().getAbsolutePath(), "PROJECT_DIR");
372-
return Selfie.expectSelfie(sanitizeFilePath);
371+
String sanitizeFilePath = sanitizeBiomeNative.replace(rootFolder().getAbsolutePath(), "${PROJECT_DIR}");
372+
String sanitizeUserHome = sanitizeFilePath.replace(System.getProperty("user.home"), "${user.home}");
373+
return Selfie.expectSelfie(sanitizeUserHome);
373374
}
374375
}

plugin-maven/src/test/java/com/diffplug/spotless/maven/biome/BiomeMavenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void failureWhenNotParseable() throws Exception {
249249
assertFile("biome_test.js").sameAsResource("biome/js/fileBefore.js");
250250
expectSelfieErrorMsg(result).toBe("""
251251
Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:VERSION:apply (default-cli) on project spotless-maven-plugin-tests: There were 1 lint error(s), they must be fixed or suppressed.
252-
biome_test.js:LINE_UNDEFINED biome(java.lang.RuntimeException) > arguments: [/Users/ntwigg/.m2/repository/com/diffplug/spotless/biome-exe file.json] (...)
252+
biome_test.js:LINE_UNDEFINED biome(java.lang.RuntimeException) > arguments: [${user.home}/.m2/repository/com/diffplug/spotless/biome-exe file.json] (...)
253253
Resolve these lints or suppress with `<lintSuppressions>`
254254
""");
255255
}

plugin-maven/src/test/java/com/diffplug/spotless/maven/java/LintSuppressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void testNoSuppressionFailsOnWildcardImports() throws Exception {
3333
setFile(path).toResource("java/removewildcardimports/JavaCodeWildcardsUnformatted.test");
3434

3535
expectSelfieErrorMsg(mavenRunner().withArguments("spotless:check").runHasError()).toBe("""
36-
Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:VERSION:check (default-cli) on project spotless-maven-plugin-tests: Unable to format file PROJECT_DIR/src/main/java/TestFile.java
36+
Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:VERSION:check (default-cli) on project spotless-maven-plugin-tests: Unable to format file ${PROJECT_DIR}/src/main/java/TestFile.java
3737
Step 'removeWildcardImports' found problem in 'TestFile.java':
3838
TestFile.java:L1 removeWildcardImports(import java.util.*;) Do not use wildcard imports (e.g. java.util.*) - replace with specific class imports (e.g. java.util.List) as 'spotlessApply' cannot auto-fix this
3939
TestFile.java:L2 removeWildcardImports(import static java.util.Collections.*;) Do not use wildcard imports (e.g. java.util.*) - replace with specific class imports (e.g. java.util.List) as 'spotlessApply' cannot auto-fix this

0 commit comments

Comments
 (0)