@Test public void testHelpUriAndTags() { BugPattern bugPattern = new BugPattern("TYPE", "abbrev", "category", false, "shortDescription", "longDescription", "detailText", "https: DetectorFactoryCollection.instance().registerBugPattern(bugPattern); reporter.reportBug(new BugInstance(bugPattern.getType(), bugPattern.getPriorityAdjustment()).addInt(10).addClass("the/target/Class")); reporter.finish(); String json = writer.toString(); JSONObject jsonObject = new JSONObject(json); JSONObject run = jsonObject.getJSONArray("runs").getJSONObject(0); JSONArray rules = run.getJSONObject("tool").getJSONObject("driver").getJSONArray("rules"); assertThat(rules.length(), is(1)); JSONObject rule = rules.getJSONObject(0); assertThat(rule.get("helpUri"), is("https: JSONArray tags = rule.getJSONObject("properties").getJSONArray("tags"); assertThat(tags.length(), is(1)); assertThat(tags.get(0), is("category")); }
@Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); @Override void finish(); }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); @Override void finish();  }