You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vm...@apache.org on 2004/05/12 17:21:59 UTC

cvs commit: maven-plugins/checkstyle/src/plugin-test/src/main/org/apache/maven SuppressionFilterSample.java Dummy.java

vmassol     2004/05/12 08:21:59

  Modified:    checkstyle/src/plugin-test project.properties maven.xml
               checkstyle/src/plugin-test/src/main/org/apache/maven
                        Dummy.java
  Added:       checkstyle/src/plugin-test checkstyle.xml suppressions.xml
               checkstyle/src/plugin-test/src/main/org/apache/maven
                        SuppressionFilterSample.java
  Log:
  Improved plugin tests and show how to use exclusion filters
  
  Revision  Changes    Path
  1.3       +2 -0      maven-plugins/checkstyle/src/plugin-test/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/src/plugin-test/project.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.properties	4 Mar 2004 18:01:42 -0000	1.2
  +++ project.properties	12 May 2004 15:21:59 -0000	1.3
  @@ -16,3 +16,5 @@
   
   # required so it can be called from reactor
   maven.checkstyle.header.file = ${basedir}/LICENSE.txt
  +maven.checkstyle.properties=${basedir}/checkstyle.xml
  +
  
  
  
  1.4       +14 -4     maven-plugins/checkstyle/src/plugin-test/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/src/plugin-test/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml	12 Apr 2004 10:57:24 -0000	1.3
  +++ maven.xml	12 May 2004 15:21:59 -0000	1.4
  @@ -15,20 +15,30 @@
    * limitations under the License.
    */
    -->
  -<project xmlns:util="jelly:util"
  -         xmlns:j="jelly:core">
  +<project 
  +    xmlns:util="jelly:util"
  +    xmlns:j="jelly:core"
  +    xmlns:x="jelly:xml">
            
     <goal name="testPlugin" prereqs="clean,test-checkstyle-report">
     </goal>
     
     <goal name="test-checkstyle-report">
  -    <!-- work around maven checkstyle being inherited :( -->
  -    <j:set var="maven.checkstyle.properties" value=""/>
       <attainGoal name="checkstyle:report"/>
       <j:set var="expectedFile" value="${maven.gen.docs}/checkstyle-report.xml"/>
       <util:file var="file" name="${expectedFile}" />
       <j:if test="${!(file.exists())}">
         <fail>${expectedFile} not generated</fail>
       </j:if>
  +
  +    <!-- Verify that there are no Boolean instantiation errors as we have
  +         excluded the SuppressionFilterSample java file from the checks -->
  +    <util:file var="rawFile" name="${maven.build.dir}/checkstyle-raw-report.xml"/>
  +    <x:parse var="doc" xml="${rawFile}"/>
  +
  +    <x:if select="$doc//file[contains(@name,'SuppressionFilterSample')]/error[contains(@source,'IllegalInstantiationCheck')]">
  +      <fail>Should not have generated an error as we have a suppression filter set on SuppressionFilterSample</fail>
  +    </x:if>
  +
     </goal>
   </project>
  
  
  
  1.1                  maven-plugins/checkstyle/src/plugin-test/checkstyle.xml
  
  Index: checkstyle.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE module PUBLIC
      "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
      "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
  
  <module name="Checker">
    <property name="severity" value="error"/>
  
    <module name="TreeWalker">
  
      <module name="IllegalInstantiation">
        <property name="classes" value="java.lang.Boolean"/>
      </module>
    
    </module>
  
    <module name="SuppressionFilter">
      <property name="file" value="${basedir}/suppressions.xml"/>
    </module>
  
  </module>
  
  
  
  1.1                  maven-plugins/checkstyle/src/plugin-test/suppressions.xml
  
  Index: suppressions.xml
  ===================================================================
  <?xml version="1.0"?> 
  <!DOCTYPE suppressions PUBLIC 
        "-//Puppy Crawl//DTD Suppressions 1.0//EN" 
        "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> 
  
  <suppressions>
  	<suppress checks="IllegalInstantiation"
          files="org.apache.maven.SuppressionFilterSample.java"/>
  </suppressions>
  
  
  
  1.2       +2 -0      maven-plugins/checkstyle/src/plugin-test/src/main/org/apache/maven/Dummy.java
  
  Index: Dummy.java
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/src/plugin-test/src/main/org/apache/maven/Dummy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Dummy.java	22 Sep 2003 01:14:22 -0000	1.1
  +++ Dummy.java	12 May 2004 15:21:59 -0000	1.2
  @@ -2,5 +2,7 @@
   
   public class Dummy
   {
  +    // Voluntarily missing static keyword in order to trigger the
  +    // VisibilityModifier check (only static members must be private).
       public String badChecky = "error";
   } 
  
  
  
  1.1                  maven-plugins/checkstyle/src/plugin-test/src/main/org/apache/maven/SuppressionFilterSample.java
  
  Index: SuppressionFilterSample.java
  ===================================================================
  package org.apache.maven;
  
  import java.lang.Boolean;
  
  public class SuppressionFilterSample
  {
  	// Voluntarily instantiate a boolean in order to have the
      // IllegalInstantiationCheck check fail. We let it pass using a
      // suppression filter in order to test that feature.
      public Boolean forbidden = new Boolean(true);
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org