creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject svn commit: r1811592 - /creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java
Date Mon, 09 Oct 2017 18:31:53 GMT
Author: pottlinger
Date: Mon Oct  9 18:31:53 2017
New Revision: 1811592

URL: http://svn.apache.org/viewvc?rev=1811592&view=rev
Log:
RAT-240: Add comments in exclusion files/change parsing

* Added skippig of empty and comment lines.
* Added new NameFileFilter and WildcardFileFilter to support more
exclusions in different formats.

Modified:
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java?rev=1811592&r1=1811591&r2=1811592&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/Report.java Mon Oct  9
18:31:53 2017
@@ -21,6 +21,7 @@ package org.apache.rat;
 import org.apache.commons.cli.*;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.*;
+import org.apache.commons.lang.StringUtils;
 import org.apache.rat.api.RatException;
 import org.apache.rat.report.IReportable;
 import org.apache.rat.report.RatReport;
@@ -117,16 +118,24 @@ public class Report {
 
     static FilenameFilter parseExclusions(List<String> excludes) throws IOException
{
         final OrFileFilter orFilter = new OrFileFilter();
+        int ignoredLines = 0;
         for (String exclude : excludes) {
             try {
+                // skip comments
+                if(exclude.startsWith("#") || StringUtils.isEmpty(exclude)) {
+                    ignoredLines++;
+                    continue;
+                }
+
                 orFilter.addFileFilter(new RegexFileFilter(exclude));
                 // RAT-240: verify it works properly
-                //orFilter.addFileFilter(new NameFileFilter(exclude));
-                //orFilter.addFileFilter(new WildcardFileFilter(exclude));
+                orFilter.addFileFilter(new NameFileFilter(exclude));
+                orFilter.addFileFilter(new WildcardFileFilter(exclude));
             } catch(PatternSyntaxException e) {
                 System.err.println("Will skip given exclusion '" + exclude + "' due to "
+ e);
             }
         }
+        System.out.println("Ignored " + ignoredLines + " lines in your exclusion files as
comments or empty lines.");
         return new NotFileFilter(orFilter);
     }
 



Mime
View raw message