Skip to content

Commit f8b55fd

Browse files
authored
Clarify and simplify isDirectoryExcluded (#222)
* simplify excluded check * rewrite exception message
1 parent bceafe3 commit f8b55fd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,25 +368,23 @@ protected Map<File, PmdFileInfo> getFilesToProcess() throws IOException {
368368
return files;
369369
}
370370

371-
private boolean isDirectoryExcluded(Collection<File> excludeRootFiles, File sourceDirectoryToCheck) {
372-
boolean returnVal = false;
373-
for (File excludeDir : excludeRootFiles) {
371+
private boolean isDirectoryExcluded(Collection<File> excludedRootFiles, File sourceDirectoryToCheck) {
372+
for (File excludedDirectory : excludedRootFiles) {
374373
try {
375374
if (sourceDirectoryToCheck
376375
.getCanonicalFile()
377376
.toPath()
378-
.startsWith(excludeDir.getCanonicalFile().toPath())) {
377+
.startsWith(excludedDirectory.getCanonicalFile().toPath())) {
379378
getLog().debug("Directory " + sourceDirectoryToCheck.getAbsolutePath()
380379
+ " has been excluded as it matches excludeRoot "
381-
+ excludeDir.getAbsolutePath());
382-
returnVal = true;
383-
break;
380+
+ excludedDirectory.getAbsolutePath());
381+
return true;
384382
}
385383
} catch (IOException e) {
386-
getLog().warn("Error while checking " + sourceDirectoryToCheck + " whether it should be excluded.", e);
384+
getLog().warn("Error while checking whether " + sourceDirectoryToCheck + " should be excluded.", e);
387385
}
388386
}
389-
return returnVal;
387+
return false;
390388
}
391389

392390
/**

0 commit comments

Comments
 (0)