use of com.contrastsecurity.sarif.Invocation in project bsl-language-server by 1c-syntax.
the class SarifReporter method createInvocation.
private Invocation createInvocation() {
Set<ConfigurationOverride> ruleConfigurationOverrides = new HashSet<>();
var diagnosticsOptions = configuration.getDiagnosticsOptions();
diagnosticsOptions.getParameters().forEach((String key, Either<Boolean, Map<String, Object>> option) -> {
var descriptor = new ReportingDescriptorReference().withId(key);
var configurationOverride = new ConfigurationOverride().withDescriptor(descriptor);
var reportingConfiguration = new ReportingConfiguration();
if (option.isLeft()) {
reportingConfiguration.setEnabled(option.getLeft());
} else {
var parameters = new PropertyBag();
var diagnosticParameters = option.getRight();
diagnosticParameters.forEach(parameters::setAdditionalProperty);
reportingConfiguration.setParameters(parameters);
}
configurationOverride.withConfiguration(reportingConfiguration);
ruleConfigurationOverrides.add(configurationOverride);
});
ArtifactLocation workingDirectory = new ArtifactLocation().withUri(Absolute.uri(new File(".").toURI()).toString());
return new Invocation().withExecutionSuccessful(true).withRuleConfigurationOverrides(ruleConfigurationOverrides).withWorkingDirectory(workingDirectory).withProcessId((int) ProcessHandle.current().pid());
}
Aggregations