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/05/20 12:00:21 UTC

[commons-statistics] 01/02: Upgrade checkstyle version.

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-statistics.git

commit 61c9a368e66095eb7c30a3b67748b8d67bb59302
Author: aherbert <ah...@apache.org>
AuthorDate: Mon May 20 12:58:52 2019 +0100

    Upgrade checkstyle version.
    
    Fix Java 8 checkstyle violation.
---
 .../AbstractContinuousDistribution.java            |  2 +-
 pom.xml                                            | 15 +++++-
 src/main/resources/checkstyle/checkstyle.xml       | 63 +++++-----------------
 3 files changed, 27 insertions(+), 53 deletions(-)

diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/AbstractContinuousDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/AbstractContinuousDistribution.java
index e8d19c3..a3f0e70 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/AbstractContinuousDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/AbstractContinuousDistribution.java
@@ -129,7 +129,7 @@ abstract class AbstractContinuousDistribution
         double x = new BrentSolver(solverRelativeAccuracy,
                                    solverAbsoluteAccuracy,
                                    solverFunctionValueAccuracy)
-            .solve((arg) -> cumulativeProbability(arg) - p,
+            .solve(arg -> cumulativeProbability(arg) - p,
                    lowerBound,
                    0.5 * (lowerBound + upperBound),
                    upperBound);
diff --git a/pom.xml b/pom.xml
index 3749647..d157a94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,8 @@
     <maven.compiler.target>1.8</maven.compiler.target>
     <statistics.pmd.version>3.8</statistics.pmd.version>
     <statistics.spotbugs.version>3.1.11</statistics.spotbugs.version>
-    <statistics.checkstyle.version>2.17</statistics.checkstyle.version>
+    <statistics.checkstyle.version>3.0.0</statistics.checkstyle.version>
+    <statistics.checkstyle.dep.version>8.18</statistics.checkstyle.dep.version>
     <statistics.clirr.version>2.8</statistics.clirr.version>
     <!-- Workaround to avoid duplicating config files. -->
     <statistics.parent.dir>${basedir}</statistics.parent.dir>
@@ -229,6 +230,13 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
         <version>${statistics.checkstyle.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>${statistics.checkstyle.dep.version}</version>
+          </dependency>
+        </dependencies>
         <configuration>
           <configLocation>${statistics.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
           <headerLocation>${statistics.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
@@ -355,8 +363,11 @@
         <configuration>
           <configLocation>${statistics.parent.dir}/src/main/resources/checkstyle/checkstyle.xml</configLocation>
           <headerLocation>${statistics.parent.dir}/src/main/resources/checkstyle/license-header.txt</headerLocation>
+          <suppressionsLocation>${statistics.parent.dir}/src/main/resources/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
           <enableRulesSummary>false</enableRulesSummary>
-          <includeResources>false</includeResources>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <logViolationsToConsole>false</logViolationsToConsole>
+          <resourceExcludes>NOTICE.txt,LICENSE.txt,**/maven-archiver/pom.properties</resourceExcludes>
         </configuration>
         <reportSets>
           <reportSet>
diff --git a/src/main/resources/checkstyle/checkstyle.xml b/src/main/resources/checkstyle/checkstyle.xml
index a138af6..09cb382 100644
--- a/src/main/resources/checkstyle/checkstyle.xml
+++ b/src/main/resources/checkstyle/checkstyle.xml
@@ -17,9 +17,9 @@
    limitations under the License.
   -->
 
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.1//EN" "https://checkstyle.org/dtds/configuration_1_1.dtd">
 
-<!-- Commons RNG customization of default Checkstyle behavior -->
+<!-- Commons statistics customization of default Checkstyle behavior -->
 <module name="Checker">
   <property name="localeLanguage" value="en"/>
 
@@ -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,5 @@
   <!-- 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>