You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2018/12/17 13:01:09 UTC
[maven-checkstyle-plugin] 01/01: [MCHECKSTYLE-357] - Expand inline
documentation
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch MCHECKSTYLE-357
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git
commit 84acd48fb1d659de37a9db5e44764a49b8800872
Author: Peter Lamby <pe...@web.de>
AuthorDate: Mon Dec 17 12:30:13 2018 +0100
[MCHECKSTYLE-357] - Expand inline documentation
---
src/site/apt/examples/inline-checker-config.apt.vm | 74 ++++++++++++++++++++++
src/site/apt/examples/multi-module-config.apt.vm | 4 ++
2 files changed, 78 insertions(+)
diff --git a/src/site/apt/examples/inline-checker-config.apt.vm b/src/site/apt/examples/inline-checker-config.apt.vm
index c366829..ec64e52 100644
--- a/src/site/apt/examples/inline-checker-config.apt.vm
+++ b/src/site/apt/examples/inline-checker-config.apt.vm
@@ -86,3 +86,77 @@ Using an Inline Checkstyle Checker Configuration
</project>
+-----+
+Using a different header
+
+ The inline configuration works by writing the configuration to a file and passing that
+ file to checkstyle. This configuration file must contain a specific
+ {{{http://checkstyle.sourceforge.net/config.html#Configuration_XML_Structure}header}}.
+
+ We include one by default that is compatible with the included checkstyle version.
+
+ When you use a different checkstyle version than the the one that's included it might
+ be necessary for you to specify a different header:
+
++-----+
+<project>
+ ...
+ <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>
+ <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>
+ <checkstyleRulesHeader>
+<![CDATA[
+<!DOCTYPE module PUBLIC
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+]]>
+ </checkstyleRulesHeader>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>8.15</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ ...
+</project>
++-----+
diff --git a/src/site/apt/examples/multi-module-config.apt.vm b/src/site/apt/examples/multi-module-config.apt.vm
index 1fc9bc1..034ea60 100644
--- a/src/site/apt/examples/multi-module-config.apt.vm
+++ b/src/site/apt/examples/multi-module-config.apt.vm
@@ -27,6 +27,10 @@
Multimodule Configuration
+ Since version 2.12 of this Plugin you can also
+ {{{./inline-checker-config.html}inline}} the configuration directly in the
+ parent pom.
+
Configuring the Checkstyle Plugin for use within large multimodule projects
can be done, but it requires a little setup.