You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2013/11/10 23:07:55 UTC

svn commit: r1540563 - in /maven/plugins/trunk/maven-checkstyle-plugin/src: main/java/org/apache/maven/plugin/checkstyle/ site/apt/ site/fml/

Author: bimargulies
Date: Sun Nov 10 22:07:54 2013
New Revision: 1540563

URL: http://svn.apache.org/r1540563
Log:
MCHECKSTYLE-197 MCHECKSTYLE-202: Clarify reporting versus checking.

Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/usage.apt.vm
    maven/plugins/trunk/maven-checkstyle-plugin/src/site/fml/faq.fml

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleAggregateReport.java Sun Nov 10 22:07:54 2013
@@ -29,8 +29,7 @@ import java.io.File;
 import java.util.List;
 
 /**
- * Perform a Checkstyle analysis, and generate a report on violations,
- * aggregating the result in the project which started this mojo.
+ * A reporting task that performs Checkstyle analysis and generates an aggregate HTML report on the violations that checkstyle finds in a multi-module reactor build.
  *
  * @version $Id$
  * @since 2.8

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Sun Nov 10 22:07:54 2013
@@ -34,7 +34,7 @@ import java.util.Locale;
 import java.util.Map;
 
 /**
- * Perform a Checkstyle analysis, and generate a report on violations.
+ * A reporting task that performs Checkstyle analysis and generates an HTML report on any violations that Checkstyle finds.
  *
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Sun Nov 10 22:07:54 2013
@@ -50,9 +50,8 @@ import java.io.Reader;
 import java.util.List;
 
 /**
- * Perform a violation check against the last Checkstyle run to see if there are
- * any violations. It reads the Checkstyle output file, counts the number of
- * violations found and displays it on the console.
+ * Performs Checkstyle analysis and outputs violations or a count of violations to the console, potentially failing the build.
+ * It can also be configured to re-use an earlier analysis.
  *
  * @author <a href="mailto:joakim@erdfelt.net">Joakim Erdfelt</a>
  * @version $Id$

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm Sun Nov 10 22:07:54 2013
@@ -41,14 +41,11 @@ ${project.name}
 
    The Checkstyle Plugin has three goals:
 
-   * {{{./checkstyle-mojo.html}checkstyle:checkstyle}} performs Checkstyle analysis and generates a report on violations.
+   * {{{./checkstyle-mojo.html}checkstyle:checkstyle}} is a reporting goal that performs Checkstyle analysis and generates a report on violations.
 
-   * {{{./checkstyle-aggregate-mojo.html}checkstyle:checkstyle-aggregate}} performs Checkstyle analysis and generates a
-     report on violations, aggregating the result in the project which started this goal.
+   * {{{./checkstyle-aggregate-mojo.html}checkstyle:checkstyle-aggregate}} is a reporting goal that performs Checkstyle analysis and generates an aggregate HTML report on violations in a multi-module reactor build.
 
-   * {{{./check-mojo.html}checkstyle:check}} performs a violation check against the last Checkstyle run to see if there are
-     any violations. It reads the Checkstyle output file, counts the number of violations found and displays it on the
-     console.
+   * {{{./check-mojo.html}checkstyle:check}} is a goal that performs Checkstyle analysis and outputs violations or a count of violations to the console, potentially failing the build. It can also be configured to re-use an earlier analysis.
 
 * Usage
 

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/usage.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/usage.apt.vm?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/usage.apt.vm (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/usage.apt.vm Sun Nov 10 22:07:54 2013
@@ -40,15 +40,22 @@ Usage
 +-----+
 <project>
   ...
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <version>${project.version}</version>
-      </plugin>
-    </plugins>
-  </reporting>
+   <reporting>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-checkstyle-plugin</artifactId>
+          <version>${project.version}</version>
+          <reportSets>
+            <reportSet>
+              <reports>
+                <report>checkstyle</report>
+              </reports>
+            </reportSet>
+          </reportSets>
+        </plugin>
+      </plugins>
+    </reporting>
   ...
 </project>
 +-----+
@@ -62,42 +69,46 @@ mvn site
 * Generate Checkstyle Report As Standalone
 
   You can also generate the Checkstyle report by explicitly executing the <<<checkstyle:checkstyle>>> goal from the
-  command line. It is not required to specify the Checkstyle Plugin in your
+  command line. You are not required to specify the Checkstyle Plugin in your
   <<<pom.xml>>> unless you want to use a specific configuration.
 
 +-----+
 mvn checkstyle:checkstyle
 +-----+
 
-* Configure the Checkstyle Plugin
+* Checking for Violations as Part of the Build
 
-** Maven 3
+  If you want to report to the console or fail
+  the build, you must add an execution of <<<checkstyle::check>>> to the <<<\<build\>>>> element
+  and configure any options that you need.
+
+  (Note in that for Maven 3, as per {{{https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes}Maven 3 Compatibility Notes}},
+  in Maven 3, options you set in the <<<\<reporting\>>>> element do not have any effect on executions in the <<<\<build\>>>> element.)
+
+  For example:
+
++------+
+ <plugin>
+   <groupId>org.apache.maven.plugins</groupId>
+   <artifactId>maven-checkstyle-plugin</artifactId>
+   <version>${project.version}</version>
+   <executions>
+     <execution>
+       <id>validate</id>
+       <phase>validate</phase>
+       <configuration>
+         <configLocation>checkstyle.xml</configLocation>
+         <encoding>UTF-8</encoding>
+         <consoleOutput>true</consoleOutput>
+         <failsOnError>true</failsOnError>
+         <linkXRef>false</linkXRef>
+       </configuration>
+       <goals>
+         <goal>check</goal>
+       </goals>
+     </execution>
+   </executions>
+ </plugin>
++------+
 
-  As per {{{https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html}Maven 3 Compatibility Notes}}
-  to configure the Checkstyle Plugin, you need to the add it in the <<<\<build\>>>> section of your <<<pom.xml>>> as
-  shown in the sample below.
 
-+-----+
-<project>
-  ...
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <version>${project.version}</version>
-        <configuration>
-          <enableRulesSummary>false</enableRulesSummary>
-           ...
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  ...
-</project>
-+-----+
-
-** Maven 2
-
-  You may need to duplicate some configuration details between the <<<\<build\>>>> section and the <<<\<reporting\>>>>
-  section, depending on whether you use maven-checkstyle-plugin as part of the build, part of site, or both.
\ No newline at end of file

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/fml/faq.fml?rev=1540563&r1=1540562&r2=1540563&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/fml/faq.fml Sun Nov 10 22:07:54 2013
@@ -53,5 +53,16 @@ under the License.
         </p>
       </answer>
     </faq>
+     <faq id="What is the difference between checkstyle:checkstyle and checkstyle:check">
+          <question>What is the difference between checkstyle:checkstyle and checkstyle:check?</question>
+          <answer>
+            <p>
+              The checkstyle:checkstyle goal is a <strong>reporting</strong> goal that adds a report
+              of Checkstyle violations to the output of the maven-site-plugin. The checkstyle:check goal
+              is an ordinary goal that reports violations to the console and/or fails the build when there
+              are violations.
+            </p>
+          </answer>
+        </faq>
   </part>
 </faqs>