Package dev.metaschema.modules.sarif
Class SarifValidationHandler
java.lang.Object
dev.metaschema.modules.sarif.SarifValidationHandler
Supports building a Static Analysis Results Interchange Format (SARIF)
document based on a set of validation findings.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IAttributable.KeyThe property key for specifying markdown-formatted help content for a constraint.static final IAttributable.KeyThe property key for specifying plain text help content for a constraint.static final IAttributable.KeyThe property key for specifying a URL that provides help information for a constraint. -
Constructor Summary
ConstructorsConstructorDescriptionSarifValidationHandler(URI source, IVersionInfo toolVersion) Construct a new validation handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinding(IValidationFinding finding) Register a validation finding.voidaddFindings(Collection<? extends IValidationFinding> findings) Register a collection of validation finding.voidwrite(Path outputFile, IBindingContext bindingContext) Write the collection of findings to the provided output file.writeToString(IBindingContext bindingContext) Write the collection of findings to a string in SARIF format.
-
Field Details
-
SARIF_HELP_URL_KEY
The property key for specifying a URL that provides help information for a constraint. -
SARIF_HELP_TEXT_KEY
The property key for specifying plain text help content for a constraint. -
SARIF_HELP_MARKDOWN_KEY
The property key for specifying markdown-formatted help content for a constraint.
-
-
Constructor Details
-
SarifValidationHandler
Construct a new validation handler.- Parameters:
source- the URI of the content that was validatedtoolVersion- the version information for the tool producing the validation results
-
-
Method Details
-
addFindings
Register a collection of validation finding.- Parameters:
findings- the findings to register
-
addFinding
Register a validation finding.- Parameters:
finding- the finding to register
-
writeToString
Write the collection of findings to a string in SARIF format.- Parameters:
bindingContext- the context used to access Metaschema module information based on Java class bindings- Returns:
- the SARIF document as a string
- Throws:
IOException- if an error occurred while generating the SARIF document
-
write
public void write(@NonNull Path outputFile, @NonNull IBindingContext bindingContext) throws IOException Write the collection of findings to the provided output file.- Parameters:
outputFile- the path to the output file to write tobindingContext- the context used to access Metaschema module information based on Java class bindings- Throws:
IOException- if an error occurred while writing the SARIF file
-