checkstyle recommendations

This commit is contained in:
Jeremy Long
2016-12-22 07:32:04 -05:00
parent f9d3a9d8d8
commit 38bf9b4ddb
15 changed files with 32 additions and 34 deletions

View File

@@ -205,6 +205,7 @@ public class App {
* @param excludes the patterns for files/directories to exclude
* @param symLinkDepth the depth that symbolic links will be followed
* @param cvssFailScore the score to fail on if a vulnerability is found
* @return the exit code if there was an error
*
* @throws InvalidScanPathException thrown if the path to scan starts with
* "//"
@@ -216,7 +217,8 @@ public class App {
* collection.
*/
private int runScan(String reportDirectory, String outputFormat, String applicationName, String[] files,
String[] excludes, int symLinkDepth, int cvssFailScore) throws InvalidScanPathException, DatabaseException, ExceptionCollection, ReportException {
String[] excludes, int symLinkDepth, int cvssFailScore) throws InvalidScanPathException, DatabaseException,
ExceptionCollection, ReportException {
Engine engine = null;
int retCode = 0;
try {
@@ -308,11 +310,12 @@ public class App {
//Set the exit code based on whether we found a high enough vulnerability
for (Dependency dep : dependencies) {
if (dep.getVulnerabilities().size() != 0) {
if (!dep.getVulnerabilities().isEmpty()) {
for (Vulnerability vuln : dep.getVulnerabilities()) {
LOGGER.debug("VULNERABILITY FOUND " + dep.getDisplayFileName());
if (vuln.getCvssScore() > cvssFailScore)
if (vuln.getCvssScore() > cvssFailScore) {
retCode = 1;
}
}
}
}

View File

@@ -290,7 +290,8 @@ public final class CliParser {
.build();
final Option failOnCVSS = Option.builder().argName("score").hasArg().longOpt(ARGUMENT.FAIL_ON_CVSS)
.desc("Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11; since the CVSS scores are 0-10, by default the build will never fail.")
.desc("Specifies if the build should be failed if a CVSS score above a specified level is identified. "
+ "The default is 11; since the CVSS scores are 0-10, by default the build will never fail.")
.build();
//This is an option group because it can be specified more then once.
@@ -1111,13 +1112,14 @@ public final class CliParser {
}
/**
* Returns the CVSS value to fail on
* Returns the CVSS value to fail on.
*
* @return 11 if nothing is set. Otherwise it returns the int passed from the command line arg
* @return 11 if nothing is set. Otherwise it returns the int passed from
* the command line arg
*/
public int getFailOnCVSS() {
if(line.hasOption(ARGUMENT.FAIL_ON_CVSS)) {
String value = line.getOptionValue(ARGUMENT.FAIL_ON_CVSS);
if (line.hasOption(ARGUMENT.FAIL_ON_CVSS)) {
final String value = line.getOptionValue(ARGUMENT.FAIL_ON_CVSS);
try {
return Integer.parseInt(value);
} catch (NumberFormatException nfe) {
@@ -1310,8 +1312,7 @@ public final class CliParser {
*/
public static final String SUPPRESSION_FILE = "suppression";
/**
* The CLI argument name for setting the location of the hint
* file.
* The CLI argument name for setting the location of the hint file.
*/
public static final String HINTS_FILE = "hints";
/**