Skip to content

Commit

Permalink
added option serverityLimit which can be set to 0 suppress reachabili…
Browse files Browse the repository at this point in the history
…ty warnings
  • Loading branch information
Schaef committed Mar 30, 2017
1 parent cb642a0 commit b71730c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/main/java/bixie/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public Set<String> 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -");
}
}


Expand Down
15 changes: 8 additions & 7 deletions src/main/java/bixie/checker/reportprinter/HtmlReportPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ public String printSummary() {
bodyText.append("<p>Nothing found</p>\n");
}
cirtical += count;
bodyText.append("<h6>Unreachability warnings</h6>\n");
count = createSnippet(fname, bodyText, jsText, 1);
if (count == 0) {
bodyText.append("<p>Nothing found</p>\n");
if (bixie.Options.v().serverityLimit > 0) {
bodyText.append("<h6>Unreachability warnings</h6>\n");
count = createSnippet(fname, bodyText, jsText, 1);
if (count == 0) {
bodyText.append("<p>Nothing found</p>\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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public String printSummary() {

protected void consumeReport(Report r) {
for (Entry<Integer, List<Report.FaultExplanation>> 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");
Expand Down

0 comments on commit b71730c

Please sign in to comment.