Search in sources :

Example 1 with Tool

use of com.contrastsecurity.sarif.Tool in project bsl-language-server by 1c-syntax.

the class SarifReporter method createTool.

private Tool createTool() {
    var name = serverInfo.getName();
    var organization = "1c-syntax";
    var version = serverInfo.getVersion();
    var informationUri = URI.create(configuration.getSiteRoot());
    var language = configuration.getLanguage().getLanguageCode();
    var rules = diagnosticInfos.stream().map(SarifReporter::createReportingDescriptor).collect(Collectors.toSet());
    var driver = new ToolComponent().withName(name).withOrganization(organization).withVersion(version).withInformationUri(informationUri).withLanguage(language).withRules(rules);
    return new Tool().withDriver(driver);
}
Also used : ToolComponent(com.contrastsecurity.sarif.ToolComponent) Tool(com.contrastsecurity.sarif.Tool)

Example 2 with Tool

use of com.contrastsecurity.sarif.Tool 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

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