From 19a7a5ee84a59fb9aa5b03f7adca5dd085a091a4 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Sat, 21 Sep 2024 15:14:12 +0000 Subject: [PATCH] refactor: Operator wrapping on end of line Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.OperatorWrap?organizationId=T3BlblJld3JpdGU%3D#defaults=W3sidmFsdWUiOiJFT0wiLCJuYW1lIjoid3JhcE9wdGlvbiJ9XQ== Co-authored-by: Moderne --- .../gradle/isolated/DefaultProjectParser.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java b/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java index 399151c4..7436dbae 100644 --- a/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java +++ b/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java @@ -488,9 +488,9 @@ public void run(ResultsContainer results, ExecutionContext ctx) { Path afterLocation = results.getProjectRoot().resolve(result.getAfter().getSourcePath()); File afterParentDir = afterLocation.toFile().getParentFile(); // Rename the directory if its name case has been changed, e.g. camel case to lower case. - if (afterParentDir.exists() - && afterParentDir.getAbsolutePath().equalsIgnoreCase((originalParentDir.getAbsolutePath())) - && !afterParentDir.getAbsolutePath().equals(originalParentDir.getAbsolutePath())) { + if (afterParentDir.exists() && + afterParentDir.getAbsolutePath().equalsIgnoreCase((originalParentDir.getAbsolutePath())) && + !afterParentDir.getAbsolutePath().equals(originalParentDir.getAbsolutePath())) { if (!originalParentDir.renameTo(afterParentDir)) { throw new RuntimeException("Unable to rename directory from " + originalParentDir.getAbsolutePath() + " To: " + afterParentDir.getAbsolutePath()); } @@ -1101,14 +1101,14 @@ private SourceFileStream parseGradleFiles( public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { Path dirFromRoot = baseDir.relativize(dir); String name = dirFromRoot.toString(); - if (subproject.getLayout().getBuildDirectory().getAsFile().get().toPath().equals(dir) - || name.startsWith(".") // Skip .gradle, .idea, .moderne, etc. + if (subproject.getLayout().getBuildDirectory().getAsFile().get().toPath().equals(dir) || + name.startsWith(".") // Skip .gradle, .idea, .moderne, etc. || name.equals("out") // IntelliJ standard output directory || subproject.getSubprojects().stream() - .anyMatch(sp -> dir.equals(sp.getProjectDir().toPath())) - || subproject.getGradle().getIncludedBuilds().stream() - .anyMatch(ib -> dir.equals(ib.getProjectDir().toPath())) - || isExcluded(exclusions, baseDir.relativize(dir))) { + .anyMatch(sp -> dir.equals(sp.getProjectDir().toPath())) || + subproject.getGradle().getIncludedBuilds().stream() + .anyMatch(ib -> dir.equals(ib.getProjectDir().toPath())) || + isExcluded(exclusions, baseDir.relativize(dir))) { return FileVisitResult.SKIP_SUBTREE; }