From b0727ef3cf992833622fff478ce80efaa540273f Mon Sep 17 00:00:00 2001 From: Rudra Peram Date: Wed, 25 Mar 2015 23:52:48 -0700 Subject: [PATCH] Set a property to determine whether external reports need to be generated or not Former-commit-id: 83ce9ecd722f47140198e276ecc86d279f39d881 --- .../agent/DependencyCheckScanAgent.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java index f88483487..f94a46c72 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java @@ -209,6 +209,29 @@ public class DependencyCheckScanAgent { this.autoUpdate = autoUpdate; } + /** + * flag indicating whether or not to generate a report of findings. + */ + private boolean generateReport = true; + + /** + * Get the value of generateReport. + * + * @return the value of generateReport + */ + public boolean isGenerateReport() { + return generateReport; + } + + /** + * Set the value of generateReport. + * + * @param generateReport new value of generateReport + */ + public void setGenerateReport(boolean generateReport) { + this.generateReport = generateReport; + } + /** * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this * within the Site plugin unless the externalReport is set to true. Default is HTML. @@ -945,11 +968,13 @@ public class DependencyCheckScanAgent { * @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the * scan. */ - public void execute() throws ScanAgentException { + public Engine execute() throws ScanAgentException { Engine engine = null; try { engine = executeDependencyCheck(); - generateExternalReports(engine, new File(this.reportOutputDirectory)); + if (this.generateReport) { + generateExternalReports(engine, new File(this.reportOutputDirectory)); + if (this.showSummary) { showSummary(engine.getDependencies()); } @@ -966,6 +991,7 @@ public class DependencyCheckScanAgent { engine.cleanup(); } } + return engine; } /**