Skip to content

Commit

Permalink
STORM-3446: storm-maven-plugins: fix all checkstyle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
krichter722 committed Jul 4, 2019
1 parent 5d582b4 commit b1ed064
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion storm-buildtools/storm-maven-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static List<File> convertFileSetToFiles(FileSet source)
@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));
Expand All @@ -113,7 +113,7 @@ private String getBuildTime() {
* @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>();
Expand Down Expand Up @@ -172,6 +172,7 @@ private String[] getSvnUriInfo(String str) {
return res;
}

@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
private String getSCMUri(SCM scm) {
String uri = "Unknown";
switch (scm) {
Expand All @@ -193,10 +194,14 @@ private String getSCMUri(SCM scm) {
}
}
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) {
Expand All @@ -216,10 +221,14 @@ private String getSCMCommit(SCM scm) {
}
}
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) {
Expand All @@ -240,6 +249,9 @@ private String getSCMBranch(SCM scm) {
}
}
break;
default:
throw new IllegalArgumentException(String.format("SCM %s is not supported",
scm));
}
return branch.trim();
}
Expand All @@ -262,14 +274,6 @@ private byte[] computeMD5(List<File> files) throws IOException,
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
Expand All @@ -291,6 +295,15 @@ private String normalizePath(File file) {
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
}
Expand Down

0 comments on commit b1ed064

Please sign in to comment.