From 6878d73bee9979ebfcaeb57d7c421cb92651d613 Mon Sep 17 00:00:00 2001 From: marcel-gepardec Date: Mon, 23 Sep 2024 11:48:50 +0200 Subject: [PATCH 1/2] Added accepted directories to accept all recursive directories within "src" --- src/main/java/org/openrewrite/maven/ResourceParser.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index db9dd597..753ce05a 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -43,6 +43,7 @@ public class ResourceParser { private static final Set DEFAULT_IGNORED_DIRECTORIES = new HashSet<>(Arrays.asList( "build", "target", "out", ".sonar", ".gradle", ".idea", ".project", "node_modules", ".git", ".metadata", ".DS_Store")); + private static final Set DEFAULT_ACCEPTED_DIRECTORIES = new HashSet<>(Arrays.asList("src")); private final Path baseDir; private final Log logger; @@ -283,6 +284,9 @@ private boolean isParsedAsPlainText(Path path) { private boolean isIgnoredDirectory(Path searchDir, Path path) { for (Path pathSegment : searchDir.relativize(path)) { + if (DEFAULT_ACCEPTED_DIRECTORIES.contains(pathSegment.toString())){ + return false; + } if (DEFAULT_IGNORED_DIRECTORIES.contains(pathSegment.toString())) { return true; } From 526bef5c002e35729a54683a75a68bb9033e5ea5 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 23 Sep 2024 12:53:11 +0200 Subject: [PATCH 2/2] Flip field order to match usage & natural order --- src/main/java/org/openrewrite/maven/ResourceParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index 753ce05a..48be210d 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -40,10 +40,10 @@ import java.util.stream.Stream; public class ResourceParser { + private static final Set DEFAULT_ACCEPTED_DIRECTORIES = new HashSet<>(Arrays.asList("src")); private static final Set DEFAULT_IGNORED_DIRECTORIES = new HashSet<>(Arrays.asList( "build", "target", "out", ".sonar", ".gradle", ".idea", ".project", "node_modules", ".git", ".metadata", ".DS_Store")); - private static final Set DEFAULT_ACCEPTED_DIRECTORIES = new HashSet<>(Arrays.asList("src")); private final Path baseDir; private final Log logger;