diff --git a/src/main/java/bixie/Options.java b/src/main/java/bixie/Options.java index 4267648..a70f6b8 100644 --- a/src/main/java/bixie/Options.java +++ b/src/main/java/bixie/Options.java @@ -80,6 +80,10 @@ public Set getSrcFilesString() { return sourceFiles; } + @Option(name = "-serverityLimit", usage = "Maximum serverity level for warnings.") + public int serverityLimit = 2; + + @Option(name = "-exportStubs", usage = "Write all used stubs to file") public String exportStubsFileName = null; diff --git a/src/main/java/bixie/checker/reportprinter/BasicReportPrinter.java b/src/main/java/bixie/checker/reportprinter/BasicReportPrinter.java index aa4f4dd..8615dde 100644 --- a/src/main/java/bixie/checker/reportprinter/BasicReportPrinter.java +++ b/src/main/java/bixie/checker/reportprinter/BasicReportPrinter.java @@ -73,7 +73,9 @@ public String printSummary() { //TODO: don't hard code the keys. sb.append("In File: " + fname+"\n"); cirtical+= printReportForFileBySeverity(sb, fname, 0, "** Critical **"); - unreachable += printReportForFileBySeverity(sb, fname, 1, " - Unreachable -"); + if (bixie.Options.v().serverityLimit>0){ + unreachable += printReportForFileBySeverity(sb, fname, 1, " - Unreachable -"); + } } diff --git a/src/main/java/bixie/checker/reportprinter/HtmlReportPrinter.java b/src/main/java/bixie/checker/reportprinter/HtmlReportPrinter.java index 73f506d..769ab71 100644 --- a/src/main/java/bixie/checker/reportprinter/HtmlReportPrinter.java +++ b/src/main/java/bixie/checker/reportprinter/HtmlReportPrinter.java @@ -107,17 +107,18 @@ public String printSummary() { bodyText.append("

Nothing found

\n"); } cirtical += count; - bodyText.append("
Unreachability warnings
\n"); - count = createSnippet(fname, bodyText, jsText, 1); - if (count == 0) { - bodyText.append("

Nothing found

\n"); + if (bixie.Options.v().serverityLimit > 0) { + bodyText.append("
Unreachability warnings
\n"); + count = createSnippet(fname, bodyText, jsText, 1); + if (count == 0) { + bodyText.append("

Nothing found

\n"); + } + unreachable += count; } - unreachable += count; - } StringBuilder sb = new StringBuilder(); - //only create a website if there is at least one report. + // only create a website if there is at least one report. if (unreachable + cirtical > 0) { // first extract the template from the Jar extractHtmlBoilerplate(); diff --git a/src/main/java/bixie/checker/reportprinter/JSONReportPrinter.java b/src/main/java/bixie/checker/reportprinter/JSONReportPrinter.java index 5667d51..b49b4b7 100644 --- a/src/main/java/bixie/checker/reportprinter/JSONReportPrinter.java +++ b/src/main/java/bixie/checker/reportprinter/JSONReportPrinter.java @@ -64,6 +64,10 @@ public String printSummary() { protected void consumeReport(Report r) { for (Entry> entry : r.getReports().entrySet()) { + if (entry.getKey()>bixie.Options.v().serverityLimit) { + // suppress warnings above threshold. + continue; + } for (Report.FaultExplanation fe : entry.getValue()) { JSONbug bug = new JSONbug(); bug.setBug_class("Inconsistent code found by Bixie");