Search in sources :

Example 1 with Run

use of com.contrastsecurity.sarif.Run in project aws-codeguru-cli by aws.

the class ResultsAdapter method createSarifReport.

private static SarifSchema210 createSarifReport(final List<RecommendationSummary> recommendations) throws IOException {
    val docUrl = "https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/how-codeguru-reviewer-works.html";
    val rulesMap = createSarifRuleDescriptions(recommendations);
    val driver = new ToolComponent().withName("CodeGuru Reviewer Scanner").withInformationUri(URI.create(docUrl)).withRules(new HashSet<>(rulesMap.values()));
    val results = recommendations.stream().map(ResultsAdapter::convertToSarif).collect(Collectors.toList());
    val run = new Run().withTool(new Tool().withDriver(driver)).withResults(results);
    return new SarifSchema210().withVersion(SarifSchema210.Version._2_1_0).with$schema(URI.create("http://json.schemastore.org/sarif-2.1.0-rtm.4")).withRuns(Arrays.asList(run));
}
Also used : lombok.val(lombok.val) SarifSchema210(com.contrastsecurity.sarif.SarifSchema210) Run(com.contrastsecurity.sarif.Run) ToolComponent(com.contrastsecurity.sarif.ToolComponent) Tool(com.contrastsecurity.sarif.Tool)

Aggregations

Run (com.contrastsecurity.sarif.Run)1 SarifSchema210 (com.contrastsecurity.sarif.SarifSchema210)1 Tool (com.contrastsecurity.sarif.Tool)1 ToolComponent (com.contrastsecurity.sarif.ToolComponent)1 lombok.val (lombok.val)1