This is an automated email from the ASF dual-hosted git repository.

srdo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new b1ed064  STORM-3446: storm-maven-plugins: fix all checkstyle warnings
     new ace6289  Merge pull request #3061 from 
krichter722/checkstyle-maven-plugins
b1ed064 is described below

commit b1ed06452d809cc2402f77fc3d29c9dd462195d9
Author: Karl-Philipp Richter <krich...@posteo.de>
AuthorDate: Mon Jul 1 20:32:20 2019 +0200

    STORM-3446: storm-maven-plugins: fix all checkstyle warnings
---
 storm-buildtools/storm-maven-plugins/pom.xml       |  2 +-
 .../maven/plugin/versioninfo/VersionInfoMojo.java  | 33 +++++++++++++++-------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/storm-buildtools/storm-maven-plugins/pom.xml 
b/storm-buildtools/storm-maven-plugins/pom.xml
index c5b1b59..9a8b946 100644
--- a/storm-buildtools/storm-maven-plugins/pom.xml
+++ b/storm-buildtools/storm-maven-plugins/pom.xml
@@ -75,7 +75,7 @@
         <artifactId>maven-checkstyle-plugin</artifactId>
         <!--Note - the version would be inherited-->
         <configuration>
-          <maxAllowedViolations>11</maxAllowedViolations>
+          <maxAllowedViolations>0</maxAllowedViolations>
         </configuration>
       </plugin>
       <plugin>
diff --git 
a/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java
 
b/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java
index 9eb0298..eb1a3ae 100644
--- 
a/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java
+++ 
b/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java
@@ -89,7 +89,7 @@ public class VersionInfoMojo extends AbstractMojo {
     @Override
     public void execute() throws MojoExecutionException {
         try {
-            SCM scm = determineSCM();
+            SCM scm = determineScm();
             project.getProperties().setProperty(buildTimeProperty, 
getBuildTime());
             project.getProperties().setProperty(scmUriProperty, 
getSCMUri(scm));
             project.getProperties().setProperty(scmBranchProperty, 
getSCMBranch(scm));
@@ -113,7 +113,7 @@ public class VersionInfoMojo extends AbstractMojo {
      * @return SCM in use for this build
      * @throws Exception if any error occurs attempting to determine SCM
      */
-    private SCM determineSCM() throws Exception {
+    private SCM determineScm() throws Exception {
         CommandExec exec = new CommandExec(this);
         SCM scm = SCM.NONE;
         scmOut = new ArrayList<String>();
@@ -172,6 +172,7 @@ public class VersionInfoMojo extends AbstractMojo {
         return res;
     }
 
+    @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
     private String getSCMUri(SCM scm) {
         String uri = "Unknown";
         switch (scm) {
@@ -193,10 +194,14 @@ public class VersionInfoMojo extends AbstractMojo {
                     }
                 }
                 break;
+            default:
+                throw new IllegalArgumentException(String.format("SCM %s is 
not supported",
+                        scm));
         }
         return uri.trim();
     }
 
+    @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
     private String getSCMCommit(SCM scm) {
         String commit = "Unknown";
         switch (scm) {
@@ -216,10 +221,14 @@ public class VersionInfoMojo extends AbstractMojo {
                     }
                 }
                 break;
+            default:
+                throw new IllegalArgumentException(String.format("SCM %s is 
not supported",
+                        scm));
         }
         return commit.trim();
     }
 
+    @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
     private String getSCMBranch(SCM scm) {
         String branch = "Unknown";
         switch (scm) {
@@ -240,6 +249,9 @@ public class VersionInfoMojo extends AbstractMojo {
                     }
                 }
                 break;
+            default:
+                throw new IllegalArgumentException(String.format("SCM %s is 
not supported",
+                        scm));
         }
         return branch.trim();
     }
@@ -262,14 +274,6 @@ public class VersionInfoMojo extends AbstractMojo {
         return md5.digest();
     }
 
-    private String byteArrayToString(byte[] array) {
-        StringBuilder sb = new StringBuilder();
-        for (byte b : array) {
-            sb.append(Integer.toHexString(0xff & b));
-        }
-        return sb.toString();
-    }
-
     private String computeMD5() throws Exception {
         List<File> files = convertFileSetToFiles(source);
         // File order of MD5 calculation is significant. Sorting is done on
@@ -291,6 +295,15 @@ public class VersionInfoMojo extends AbstractMojo {
         return md5str;
     }
 
+    private String byteArrayToString(byte[] array) {
+        StringBuilder sb = new StringBuilder();
+        for (byte b : array) {
+            sb.append(Integer.toHexString(0xff & b));
+        }
+        return sb.toString();
+    }
+
+    @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
     private enum SCM {
         NONE, SVN, GIT
     }

Reply via email to