You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2014/02/27 19:51:15 UTC
svn commit: r1572678 - in
/maven/plugins/trunk/maven-checkstyle-plugin/src/site:
apt/examples/inline-checker-config.apt.vm apt/index.apt.vm site.xml
Author: struberg
Date: Thu Feb 27 18:51:14 2014
New Revision: 1572678
URL: http://svn.apache.org/r1572678
Log:
MCHECKSTYLE-211 add documentation for 'inline' checkstyle rules
Added:
maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/inline-checker-config.apt.vm
- copied, changed from r1572483, maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/index.apt.vm
maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml
Copied: maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/inline-checker-config.apt.vm (from r1572483, maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/inline-checker-config.apt.vm?p2=maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/inline-checker-config.apt.vm&p1=maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm&r1=1572483&r2=1572678&rev=1572678&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-checker-config.apt.vm (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/inline-checker-config.apt.vm Thu Feb 27 18:51:14 2014
@@ -1,7 +1,7 @@
------
- Using a Custom Checkstyle Checker Configuration
+ Using an 'inlined' Checkstyle Checker Configuration
------
- July 2006
+ Feb 2014
------
~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -25,43 +25,64 @@
~~ http://maven.apache.org/doxia/references/apt-format.html
-Using a Custom Checkstyle Checker Configuration
+Using an Inlined Checkstyle Checker Configuration
- A custom {{{http://checkstyle.sourceforge.net/config.html#Checker}Checker configuration xml file}} can
- be defined and then referenced via a URL, File, or build classpath resource reference.
+ Since version 2.12, an inlined {{{http://checkstyle.sourceforge.net/config.html#Checker}Checker configuration}} can
+ be defined directly in the <<<configuration>>> section of the plugin itself inside your pom.
- To reference a custom Checkstyle Checker configuration, use the <<<configLocation>>> parameter.
+ This is especially useful when the checkstyle checks should be executed with every compile
+ and you do not like to create an own project for your checkstyle rules and neither
+ like to have a separate parent pom structure.
+
+ To define a custom Checkstyle Checker configuration inside your pom.xml, use the <<<checkstyleRules>>> parameter.
+-----+
<project>
...
- <reporting>
+ <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>verify-style</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
- <configLocation>checkstyle.xml</configLocation>
+ <logViolationsToConsole>true</logViolationsToConsole>
+ <checkstyleRules>
+ <module name="Checker">
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength">
+ <property name="max" value="3500" />
+ <property name="fileExtensions" value="java"/>
+ </module>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter"/>
+
+ <module name="TreeWalker">
+ <module name="StaticVariableName"/>
+ <module name="TypeName">
+ <property name="format" value="^_?[A-Z][a-zA-Z0-9]*$"/>
+ </module>
+ </module>
+ </module>
+ </checkstyleRules>
</configuration>
</plugin>
</plugins>
- </reporting>
+ </build>
...
</project>
+-----+
- This example causes the Checkstyle Plugin to check for a File named <<<checkstyle.xml>>> or a
- resource named <<<checkstyle.xml>>> within the compile scope of the dependencies or build extensions
- classpath.
-
- There are 4 predefined Checkstyle configuration definitions that ship with the Checkstyle Plugin,
- the Sun Microsystems Definition is selected by default.
-
- * <<config/sun_checks.xml>> - Sun Microsystems Definition (default).
-
- * <<config/maven_checks.xml>> - Maven Development Definitions.
-
- * <<config/turbine_checks.xml>> - Turbine Development Definitions.
-
- * <<config/avalon_checks.xml>> - Avalon Development Definitions.
\ No newline at end of file
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=1572678&r1=1572677&r2=1572678&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 Thu Feb 27 18:51:14 2014
@@ -71,6 +71,8 @@ ${project.name}
The following examples show how to use the Checkstyle Plugin in more advanced usecases:
+ * {{{./examples/inline-checker-config.html}Using an 'Inline' Checkstyle Checker Configuration}}
+
* {{{./examples/custom-checker-config.html}Using a Custom Checkstyle Checker Configuration}}
* {{{./examples/custom-property-expansion.html}Using Custom Checkstyle Property Expansion Definitions}}
Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml?rev=1572678&r1=1572677&r2=1572678&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/site/site.xml Thu Feb 27 18:51:14 2014
@@ -28,6 +28,7 @@ under the License.
<item name="FAQ" href="faq.html"/>
</menu>
<menu name="Examples">
+ <item name="Using an 'Inline' Checkstyle Checker Configuration" href="/examples/inline-checker-config.html"/>
<item name="Using a Custom Checkstyle Checker Configuration" href="/examples/custom-checker-config.html"/>
<item name="Using Custom Checkstyle Property Expansion Definitions" href="/examples/custom-property-expansion.html"/>
<item name="Using a Suppressions Filter" href="/examples/suppressions-filter.html"/>