This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch return
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git

commit 55671fc565dd7a9b83672172b5a9696ed8065090
Author: Elliotte Rusty Harold <elh...@ibiblio.org>
AuthorDate: Sat Jun 7 07:19:12 2025 -0400

    simplify excluded check
---
 .../org/apache/maven/plugins/pmd/AbstractPmdReport.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 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 3176dad..d36caf8 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);
             }
         }
-        return returnVal;
+        return false;
     }
 
     /**

Reply via email to