From f2daa597ed19c28ac30f1f36bbd6674e5c3a3a56 Mon Sep 17 00:00:00 2001 From: ron190 <1971480+ron190@users.noreply.github.com> Date: Wed, 10 Jul 2024 22:21:15 +0200 Subject: [PATCH] Disable logging bugs when quiet param is active --- .../mojo/spotbugs/BaseViolationCheckMojo.groovy | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy index 58eae1f0..22236fc8 100644 --- a/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy +++ b/src/main/groovy/org/codehaus/mojo/spotbugs/BaseViolationCheckMojo.groovy @@ -428,7 +428,13 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { * @since 2.4.1 */ @Parameter(property = "spotbugs.maxAllowedViolations", defaultValue = "0") - int maxAllowedViolations + int maxAllowedViolations + + /** + * Disable bugs log. + */ + @Parameter(defaultValue = "false", property = "spotbugs.quiet") + boolean quiet @Override void execute() { @@ -488,8 +494,10 @@ abstract class BaseViolationCheckMojo extends AbstractMojo { // lower is more severe if (priorityNum <= priorityThresholdNum) { bugCountAboveThreshold += 1 - log.error(logMsg) - } else { + if (!quiet) { + log.error(logMsg) + } + } else if (!quiet) { log.info(logMsg) } }