You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/06/07 13:19:56 UTC
(maven-pmd-plugin) branch master updated: Clarify and simplify isDirectoryExcluded (#222)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new f8b55fd Clarify and simplify isDirectoryExcluded (#222)
f8b55fd is described below
commit f8b55fda6a6075c9ac937986ebe81d4825d0fc4f
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Sat Jun 7 13:19:51 2025 +0000
Clarify and simplify isDirectoryExcluded (#222)
* simplify excluded check
* rewrite exception message
---
.../org/apache/maven/plugins/pmd/AbstractPmdReport.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
index 533e5c5..2349f5d 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
@@ -368,25 +368,23 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
return files;
}
- private boolean isDirectoryExcluded(Collection<File> excludeRootFiles, File sourceDirectoryToCheck) {
- boolean returnVal = false;
- for (File excludeDir : excludeRootFiles) {
+ private boolean isDirectoryExcluded(Collection<File> excludedRootFiles, File sourceDirectoryToCheck) {
+ for (File excludedDirectory : excludedRootFiles) {
try {
if (sourceDirectoryToCheck
.getCanonicalFile()
.toPath()
- .startsWith(excludeDir.getCanonicalFile().toPath())) {
+ .startsWith(excludedDirectory.getCanonicalFile().toPath())) {
getLog().debug("Directory " + sourceDirectoryToCheck.getAbsolutePath()
+ " has been excluded as it matches excludeRoot "
- + excludeDir.getAbsolutePath());
- returnVal = true;
- break;
+ + excludedDirectory.getAbsolutePath());
+ return true;
}
} catch (IOException e) {
- getLog().warn("Error while checking " + sourceDirectoryToCheck + " whether it should be excluded.", e);
+ getLog().warn("Error while checking whether " + sourceDirectoryToCheck + " should be excluded.", e);
}
}
- return returnVal;
+ return false;
}
/**