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

Checkstyle Plugin 2.8+ generates an additional aggregate report

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8, 2.9
    • Fix Version/s: 2.10
    • Component/s: None
    • Labels:
      None
    • Environment:

      Description

      Using a very simple single module project, the aggregated report is created by default.

      Both the checkstyle and checkstyle-aggregate report are generated.

        Issue Links

          Activity

          sebbasf created issue -
          Sebb made changes -
          Field Original Value New Value
          Link This issue duplicates MCHECKSTYLE-167 [ MCHECKSTYLE-167 ]
          Dennis Lundberg made changes -
          Assignee Olivier Lamy [ olamy ]
          Fix Version/s 2.9 [ 18049 ]
          Hide
          Dennis Lundberg added a comment -

          Sebb,

          This issue was cloned from MCHECKSTYLE-167, which was fixed in 2.9. That issue was that the numbers in the report was wrong. I think your issue is that the aggregate report is enabled by default, which is a change compared to previous versions. Is that the case?

          Show
          Dennis Lundberg added a comment - Sebb, This issue was cloned from MCHECKSTYLE-167 , which was fixed in 2.9. That issue was that the numbers in the report was wrong. I think your issue is that the aggregate report is enabled by default, which is a change compared to previous versions. Is that the case?
          Hide
          Sebb added a comment -

          Yes.

          The original report that triggered the JIRA is here:
          http://www.mailinglistarchive.com/html/users@maven.apache.org/2011-12/thrd4.html#00134

          AIUI, the OP was complaining about two issues:

          • 2.8 now generates an additional aggregate report
          • the aggregate report has incorrect counts

          2.9 fixes the incorrect count problem, but not the additional aggregate report.

          Unfortunately, the JIRA settings at Codehaus are such that I could not re-open the original JIRA so I had to clone it.
          [I intended to add some further explanation, but obviously forgot, sorry.]

          It does not seem right that since 2.8 every Maven project now gets an additional aggregate report, regardless of whether the project actually has any modules to aggregate.

          Show
          Sebb added a comment - Yes. The original report that triggered the JIRA is here: http://www.mailinglistarchive.com/html/users@maven.apache.org/2011-12/thrd4.html#00134 AIUI, the OP was complaining about two issues: 2.8 now generates an additional aggregate report the aggregate report has incorrect counts 2.9 fixes the incorrect count problem, but not the additional aggregate report. Unfortunately, the JIRA settings at Codehaus are such that I could not re-open the original JIRA so I had to clone it. [I intended to add some further explanation, but obviously forgot, sorry.] It does not seem right that since 2.8 every Maven project now gets an additional aggregate report, regardless of whether the project actually has any modules to aggregate.
          Dennis Lundberg made changes -
          Summary Checkstyle runs aggregate report on projects without modules Checkstyle Plugin 2.8+ generates an additional aggregate report
          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:
          {code}
          [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] ------------------------------------------------------------------------
          {code}

          {{target/checkstyle-result.xml}} looks like this and reports the same errors twice:
          {code}
          <?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>
          {code}

          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}}.
          Using a very simple single module project, the aggregated report is created by default.

          Both the {{checkstyle}} and {{checkstyle-aggregate}} report are generated.
          Affects Version/s 2.9 [ 18049 ]
          Dennis Lundberg made changes -
          Testcase included yes [ 10040 ]
          Dennis Lundberg made changes -
          Link This issue relates to MCHECKSTYLE-62 [ MCHECKSTYLE-62 ]
          Dennis Lundberg made changes -
          Link This issue duplicates MCHECKSTYLE-167 [ MCHECKSTYLE-167 ]
          Hide
          Sebb added a comment - - edited

          Work-round (see [1]):

            <reporting>
              <plugins>
          .....
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-checkstyle-plugin</artifactId>
                      <version>2.8</version>
                      <inherited>false</inherited>
                      <reportSets>
                        <reportSet>
                          <reports>
                            <report>checkstyle</report> <!-- editted 2012-05-01; was previously "checkstyle-aggregate" which was wrong -->
                          </reports>
                        </reportSet>
                      </reportSets>
                    </plugin>
                ...
              </plugins>
            </reporting>
          

          [1] http://www.mailinglistarchive.com/html/users@maven.apache.org/2011-12/msg00134.html

          Show
          Sebb added a comment - - edited Work-round (see [1] ): <reporting> <plugins> ..... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.8</version> <inherited> false </inherited> <reportSets> <reportSet> <reports> <report>checkstyle</report> <!-- editted 2012-05-01; was previously "checkstyle-aggregate" which was wrong --> </reports> </reportSet> </reportSets> </plugin> ... </plugins> </reporting> [1] http://www.mailinglistarchive.com/html/users@maven.apache.org/2011-12/msg00134.html
          Hide
          Andrew Hunt added a comment - - edited

          Not sure that the reported fix to the count problem MCHECKSTYLE-167 has been fixed in the checkstyle-aggregate report. If you have a look at http://maven.apache.org/plugins/maven-checkstyle-plugin/project-reports.html, you will see the report repetition AND that the first report has double the issues of the second report. In the checkstyle-aggregate report, each error is reported twice.

          The workaround works great (in terms of providing one report and removing the repeats), though I had to make a minor adjustment (my full config shown)...

            <reporting>
                ...
          	<plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-checkstyle-plugin</artifactId>
                     <version>2.9</version>
          	   <inherited>false</inherited>
          	   <reportSets>
          	     <reportSet>
          		<reports>
          		  <report>checkstyle</report>        <!-- This is changed from above -->
          		</reports>
          	     </reportSet>
          	   </reportSets>
          	   <configuration>
                       <configLocation>group_default_checkstyles.xml</configLocation>
                     </configuration>
                   </plugin>
                ...
          
          Show
          Andrew Hunt added a comment - - edited Not sure that the reported fix to the count problem MCHECKSTYLE-167 has been fixed in the checkstyle-aggregate report. If you have a look at http://maven.apache.org/plugins/maven-checkstyle-plugin/project-reports.html , you will see the report repetition AND that the first report has double the issues of the second report. In the checkstyle-aggregate report, each error is reported twice. The workaround works great (in terms of providing one report and removing the repeats), though I had to make a minor adjustment (my full config shown)... <reporting> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.9</version> <inherited> false </inherited> <reportSets> <reportSet> <reports> <report>checkstyle</report> <!-- This is changed from above --> </reports> </reportSet> </reportSets> <configuration> <configLocation>group_default_checkstyles.xml</configLocation> </configuration> </plugin> ...
          Hide
          Sebb added a comment -

          @Andrew: thanks, fixed incorrect copy-paste in my earlier comment.

          Show
          Sebb added a comment - @Andrew: thanks, fixed incorrect copy-paste in my earlier comment.
          Dennis Lundberg made changes -
          Environment {{{
          mvn --version
          Apache Maven 3.0.4 (r1206075; 2011-11-25 09:20:29+0100)
          Maven home: /usr/local/Cellar/maven/current/libexec
          Java version: 1.6.0_29, vendor: Apple Inc.
          Java home: /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home
          Default locale: de_DE, platform encoding: MacRoman
          OS name: "mac os x", version: "10.7.2", arch: "x86_64", family: "mac"
          }}}
          mvn --version
          Apache Maven 3.0.4 (r1206075; 2011-11-25 09:20:29+0100)
          Maven home: /usr/local/Cellar/maven/current/libexec
          Java version: 1.6.0_29, vendor: Apple Inc.
          Java home: /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home
          Default locale: de_DE, platform encoding: MacRoman
          OS name: "mac os x", version: "10.7.2", arch: "x86_64", family: "mac"
          Fix Version/s 2.10 [ 18318 ]
          Assignee Dennis Lundberg [ dennislundberg ]
          Hide
          Justin Ye added a comment -

          Is there any update on this issue? I know we have workaround for this.
          But it seems this issue is blocking the release of new version 2.10

          Show
          Justin Ye added a comment - Is there any update on this issue? I know we have workaround for this. But it seems this issue is blocking the release of new version 2.10
          Hide
          Dennis Lundberg added a comment -

          Sorry, haven't had time to finish this yet.
          There is no rush to get 2.10 out the door.

          Show
          Dennis Lundberg added a comment - Sorry, haven't had time to finish this yet. There is no rush to get 2.10 out the door.
          Hide
          Justin Ye added a comment -

          Our company wants to upgrade to Checkstyle5.6 for a new feature(accessing suppression file on network).
          Since we are using maven in Jenkins for continious integration, we are looking forward to a coresponding upgrade in maven-checkstyle-plugin so that we can apply the upgrade to the whole company.
          This issue is not critical from my perspective since we have a workaround.
          So is it possible we can move this issue's fix to next release so that 2.10 would not be blocked.
          Many thanks!

          Show
          Justin Ye added a comment - Our company wants to upgrade to Checkstyle5.6 for a new feature(accessing suppression file on network). Since we are using maven in Jenkins for continious integration, we are looking forward to a coresponding upgrade in maven-checkstyle-plugin so that we can apply the upgrade to the whole company. This issue is not critical from my perspective since we have a workaround. So is it possible we can move this issue's fix to next release so that 2.10 would not be blocked. Many thanks!
          Hide
          Dennis Lundberg added a comment -

          Fixed in r1438951.
          I've taken care of the really simple single module case in this fix. Please give it a test.

          If you have more advanced projects that generate an aggregate report when they shouldn't - please open a separate issue for that.

          Show
          Dennis Lundberg added a comment - Fixed in r1438951 . I've taken care of the really simple single module case in this fix. Please give it a test. If you have more advanced projects that generate an aggregate report when they shouldn't - please open a separate issue for that.
          Dennis Lundberg made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Hide
          Justin Ye added a comment -

          Thank you, Dennis!
          BTW, when will 2.10 be release?

          Show
          Justin Ye added a comment - Thank you, Dennis! BTW, when will 2.10 be release?
          Hide
          Dennis Lundberg added a comment -

          We need to release the plugins-parent first.
          After that I'll release the maven-checkstyle-plugin 2.10.

          Show
          Dennis Lundberg added a comment - We need to release the plugins-parent first. After that I'll release the maven-checkstyle-plugin 2.10.
          Hide
          Justin Ye added a comment -

          So is it possible to have the new version this week? I just want to have a rough date to help me plan the upgrade. Thanks.

          Show
          Justin Ye added a comment - So is it possible to have the new version this week? I just want to have a rough date to help me plan the upgrade. Thanks.
          Mark Thomas made changes -
          Project Import Sun Apr 05 09:17:21 UTC 2015 [ 1428225441187 ]
          Mark Thomas made changes -
          Workflow jira [ 12718347 ] Default workflow, editable Closed status [ 12749805 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 22:43:44 UTC 2015 [ 1428273824526 ]
          Mark Thomas made changes -
          Workflow jira [ 12955746 ] Default workflow, editable Closed status [ 12992757 ]
          Mark Thomas made changes -
          Reporter SebbASF [ sebbasf ] Sebb [ sebb@apache.org ]
          Mark Thomas made changes -
          Assignee dennislundberg [ dennislundberg ] Dennis Lundberg [ dennisl@apache.org ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          348d 16h 47m 1 Dennis Lundberg 26/Jan/13 13:39

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Sebb
            • Votes:
              4 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development