You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/02/14 13:59:39 UTC
[commons-rng] 16/17: Updated checkstyle to use the latest
checkstyle version (8.17)
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit 26cfa3022f6e8449557562272ae5bcddb7615056
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Feb 14 13:53:45 2019 +0000
Updated checkstyle to use the latest checkstyle version (8.17)
This version of checkstyle requires java 8 and so the plugin
configuration has been moved to a profile activated by JDK 1.8+.
---
pom.xml | 120 +++++++++++++++------------
src/main/resources/checkstyle/checkstyle.xml | 60 +++-----------
2 files changed, 78 insertions(+), 102 deletions(-)
diff --git a/pom.xml b/pom.xml
index 00a9684..36ac983 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,7 @@
<maven.compiler.target>1.6</maven.compiler.target>
<rng.pmd.version>3.9.0</rng.pmd.version>
<rng.checkstyle.version>3.0.0</rng.checkstyle.version>
+ <rng.checkstyle.dep.version>8.17</rng.checkstyle.dep.version>
<rng.mathjax.version>2.7.2</rng.mathjax.version>
<!-- Workaround to avoid duplicating config files. -->
<rng.parent.dir>${basedir}</rng.parent.dir>
@@ -196,20 +197,7 @@
</ignorePathsToDelete>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>validate</id>
- <phase>validate</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <!-- maven-checkstyle-plugin runs in JDK 8+ profile -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
@@ -257,25 +245,6 @@
</plugin>
</plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${rng.checkstyle.version}</version>
- <configuration>
- <includeTestSourceDirectory>false</includeTestSourceDirectory>
- <configLocation>${rng.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
- <headerLocation>${rng.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
- <logViolationsToConsole>false</logViolationsToConsole>
- <failOnViolation>false</failOnViolation>
- <resourceExcludes>NOTICE.txt,LICENSE.txt</resourceExcludes>
- <excludes>**/module-info.java</excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
<reporting>
@@ -333,25 +302,7 @@
<excludeFilterFile>${rng.parent.dir}/src/main/resources/spotbugs/spotbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${rng.checkstyle.version}</version>
- <configuration>
- <configLocation>${rng.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
- <headerLocation>${rng.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
- <enableRulesSummary>false</enableRulesSummary>
- <includeResources>false</includeResources>
- <excludes>**/module-info.java</excludes>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>checkstyle</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
+ <!-- maven-checkstyle-plugin runs in JDK 8+ profile -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>${rng.pmd.version}</version>
@@ -567,6 +518,70 @@
</plugins>
</build>
</profile>
+ <!-- profile to allow the use of plugin versions that require Java 8+ -->
+ <profile>
+ <id>jdk8-plugins</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${rng.checkstyle.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${rng.checkstyle.dep.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <includeTestSourceDirectory>false</includeTestSourceDirectory>
+ <configLocation>${rng.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
+ <headerLocation>${rng.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
+ <logViolationsToConsole>false</logViolationsToConsole>
+ <failOnViolation>false</failOnViolation>
+ <resourceExcludes>NOTICE.txt,LICENSE.txt</resourceExcludes>
+ <excludes>**/module-info.java</excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>validate</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>${rng.checkstyle.version}</version>
+ <configuration>
+ <configLocation>${rng.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
+ <headerLocation>${rng.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
+ <enableRulesSummary>false</enableRulesSummary>
+ <includeResources>false</includeResources>
+ <excludes>**/module-info.java</excludes>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>checkstyle</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
<!--
Profiles for modules with special requirements.
@@ -582,7 +597,6 @@
</modules>
</profile>
-
<profile>
<id>release</id>
<modules>
diff --git a/src/main/resources/checkstyle/checkstyle.xml b/src/main/resources/checkstyle/checkstyle.xml
index a138af6..d867cbf 100644
--- a/src/main/resources/checkstyle/checkstyle.xml
+++ b/src/main/resources/checkstyle/checkstyle.xml
@@ -62,9 +62,6 @@
<property name="classes" value="java.lang.Boolean, java.lang.String"/>
</module>
- <!-- Required for SuppressionCommentFilter below -->
- <module name="FileContentsHolder"/>
-
<!-- Import should be explicit, really needed and only from pure java packages -->
<module name="AvoidStarImport" />
<module name="UnusedImports" />
@@ -137,6 +134,17 @@
<!-- <module name="TodoComment" /> -->
+ <!-- Setup special comments to suppress specific checks from source files -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE\: stop ([\w\|]+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE\: resume ([\w\|]+)"/>
+ <property name="checkFormat" value="$1"/>
+ </module>
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE\: stop all"/>
+ <property name="onCommentFormat" value="CHECKSTYLE\: resume all"/>
+ </module>
+
</module>
<!-- Verify that EVERY source file has the appropriate license -->
@@ -153,50 +161,4 @@
<!-- Require package javadoc -->
<module name="JavadocPackage"/>
- <!-- Setup special comments to suppress specific checks from source files -->
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop JavadocVariable"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume JavadocVariable"/>
- <property name="checkFormat" value="JavadocVariable"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop JavadocMethodCheck"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume JavadocMethodCheck"/>
- <property name="checkFormat" value="JavadocMethodCheck"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop ConstantName"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume ConstantName"/>
- <property name="checkFormat" value="ConstantName"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop HideUtilityClassConstructor"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume HideUtilityClassConstructor"/>
- <property name="checkFormat" value="HideUtilityClassConstructor"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop MultipleVariableDeclarations"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume MultipleVariableDeclarations"/>
- <property name="checkFormat" value="MultipleVariableDeclarations"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop IllegalCatch"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume IllegalCatch"/>
- <property name="checkFormat" value="IllegalCatch"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop DeclarationOrder"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume DeclarationOrder"/>
- <property name="checkFormat" value="DeclarationOrder"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop RedundantModifier"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume RedundantModifier"/>
- <property name="checkFormat" value="RedundantModifier"/>
- </module>
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE\: stop all"/>
- <property name="onCommentFormat" value="CHECKSTYLE\: resume all"/>
- </module>
</module>
-