Maven Checkstyle Plugin
  1. Maven Checkstyle Plugin
  2. MCHECKSTYLE-167

Unconfigured checkstyle plugin duplicates entries in aggregated report

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.10
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      Using a very simple single module project, the aggregated report is created by default and reports an incorrect number of violations, it just doubles the numbers. I checked out http://svn.apache.org/repos/asf/maven/plugins/tags/maven-checkstyle-plugin-2.8 and modified the integration test project checkstyle-report a little bit:

      • I deleted the reportSets configuration from the pom.xml.
      • I modified src/main/java/org/MyClass.java to actually have errors.

      The build log looks like this:

      [mirko@borg checkstyle-report]$ mvn clean site
      [INFO] Scanning for projects...
      [INFO]                                                                         
      [INFO] ------------------------------------------------------------------------
      [INFO] Building check-pass 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ check-pass ---
      [INFO] Deleting /Users/mirko/Documents/workspace/maven-checkstyle-plugin/target/it/checkstyle-report/target
      [INFO] 
      [INFO] --- maven-site-plugin:3.0:site (default-site) @ check-pass ---
      [INFO] configuring report plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.8
      [INFO] Relativizing decoration links with respect to project URL: http://maven.apache.org/
      [INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
      [INFO] Generating "Checkstyle" report    --- maven-checkstyle-plugin:2.8
      [INFO] 
      [INFO] There are 2 checkstyle errors.
      [WARNING] Unable to locate Source XRef to link to - DISABLED
      [INFO] Generating "Checkstyle" report    --- maven-checkstyle-plugin:2.8
      [INFO] 
      [INFO] There are 4 checkstyle errors.
      [WARNING] Unable to locate Source XRef to link to - DISABLED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 4.847s
      [INFO] Finished at: Tue Nov 29 21:13:40 CET 2011
      [INFO] Final Memory: 12M/81M
      [INFO] ------------------------------------------------------------------------
      

      target/checkstyle-result.xml looks like this and reports the same errors twice:

      <?xml version="1.0" encoding="UTF-8"?>
      <checkstyle version="5.4">
      <file name="/Users/mirko/Documents/workspace/maven-checkstyle-plugin/target/it/checkstyle-report/src/main/java/org/MyClass.java">
      <error line="7" column="5" severity="error" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
      <error line="7" column="22" severity="error" message="Parameter args should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
      </file>
      <file name="/Users/mirko/Documents/workspace/maven-checkstyle-plugin/target/it/checkstyle-report/src/main/java/org/MyClass.java">
      <error line="7" column="5" severity="error" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck"/>
      <error line="7" column="22" severity="error" message="Parameter args should be final." source="com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck"/>
      </file>
      </checkstyle>
      

      Both the checkstyle and checkstyle-aggregate report are generated and checkstyle-aggregate reports the same errors twice. I attach the patched project which includes a check in verify.groovy to assert that only one file entry is present in the created target/checkstyle-result.xml.

        Issue Links

          Activity

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Mirko Friedenhagen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: