mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 08:13:43 +01:00
checkstyle recommendations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user