Author: rfscholte
Date: Mon May 13 20:52:14 2013
New Revision: 1482097

URL: http://svn.apache.org/r1482097
Log:
[MCHECKSTYLE-191] Make name of TreeWalker configurable 

Modified:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java?rev=1482097&r1=1482096&r2=1482097&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/AbstractCheckstyleReport.java
 Mon May 13 20:52:14 2013
@@ -165,6 +165,14 @@ public abstract class AbstractCheckstyle
     private File xrefLocation;
 
     /**
+     * When using custom treeWalkers, specify their names here so the checks 
inside the treeWalker end up the the rule-summary
+     * 
+     * @since 2.11
+     */
+    @Parameter
+    private List<String> treeWalkerNames;
+
+    /**
      */
     @Component
     private Renderer siteRenderer;
@@ -444,6 +452,10 @@ public abstract class AbstractCheckstyle
                 getLog().warn( "Unable to locate Source XRef to link to - 
DISABLED" );
             }
         }
+        if ( treeWalkerNames != null )
+        {
+            generator.setTreeWalkerNames( treeWalkerNames );
+        }
         generator.generateReport( results );
     }
 

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java?rev=1482097&r1=1482096&r2=1482097&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java
 Mon May 13 20:52:14 2013
@@ -69,6 +69,8 @@ public class CheckstyleReportGenerator
     private SiteTool siteTool;
 
     private String xrefLocation;
+    
+    private List<String> treeWalkerNames = Collections.singletonList( 
"TreeWalker" );
 
     public CheckstyleReportGenerator( Sink sink, ResourceBundle bundle, File 
basedir, SiteTool siteTool )
     {
@@ -363,7 +365,7 @@ public class CheckstyleReportGenerator
         {
             String ruleName = configChildren[cci].getName();
 
-            if ( "TreeWalker".equals( ruleName ) )
+            if ( treeWalkerNames.contains( ruleName ) )
             {
                 // special sub-case
                 doRuleChildren( configChildren[cci], parentConfigurations, 
results );
@@ -860,5 +862,16 @@ public class CheckstyleReportGenerator
     {
         this.checkstyleConfig = config;
     }
+    
+    
+    public void setTreeWalkerNames( List<String> treeWalkerNames )
+    {
+        this.treeWalkerNames = treeWalkerNames;
+    }
+    
+    public List<String> getTreeWalkerNames()
+    {
+        return treeWalkerNames;
+    }
 
 }


Reply via email to