|
117 | 117 | * or "metadata" becomes an exclude path. Note that there are no implicit exclude paths. |
118 | 118 | * |
119 | 119 | * <p>The walking phase starts at each include path in turn and recursively traverses folders and |
120 | | - * files. Symlinks and hidden folders are skipped, but not hidden files. If it encounters a |
| 120 | + * files. Symlinks and most hidden folders are skipped, but not hidden files. If it encounters a |
121 | 121 | * sub-folder whose path is excluded, traversal stops. If it encounters a file, that file becomes a |
122 | 122 | * candidate, unless its path is excluded. If the path of a file is both an include path and an |
123 | 123 | * exclude path, the inclusion takes precedence, and the file becomes a candidate after all. |
@@ -1010,10 +1010,19 @@ && isFileIncluded(file)) { |
1010 | 1010 | return super.visitFile(file, attrs); |
1011 | 1011 | } |
1012 | 1012 |
|
| 1013 | + /** |
| 1014 | + * Returns {@code true} if {@code dir} is a hidden directory |
| 1015 | + * that should be skipped by default. |
| 1016 | + */ |
| 1017 | + private boolean isSkippedHiddenDirectory(Path dir) { |
| 1018 | + // Allow .github folders as they may contain YAML files relevant to GitHub repositories. |
| 1019 | + return dir.toFile().isHidden() && !dir.getFileName().toString().equals(".github"); |
| 1020 | + } |
| 1021 | + |
1013 | 1022 | @Override |
1014 | 1023 | public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) |
1015 | 1024 | throws IOException { |
1016 | | - if (!dir.equals(currentRoot[0]) && (excludes.contains(dir) || dir.toFile().isHidden())) |
| 1025 | + if (!dir.equals(currentRoot[0]) && (excludes.contains(dir) || isSkippedHiddenDirectory(dir))) |
1017 | 1026 | return FileVisitResult.SKIP_SUBTREE; |
1018 | 1027 | if (Files.exists(dir.resolve("codeql-database.yml"))) { |
1019 | 1028 | return FileVisitResult.SKIP_SUBTREE; |
|
0 commit comments