Update Sarif reporter to provide region info based on validator findings#442
Merged
Update Sarif reporter to provide region info based on validator findings#442
Conversation
Add ValidationError type with optional Line/Column fields to enable GitHub Actions inline annotations on affected lines. - 10 validators now return structured position info (JSON, YAML, TOML, XML, HCL, CSV, ENV, HOCON, TOON, PList) - 4 validators without position info (INI, EditorConfig, Properties, SARIF) fall back to file-level annotations - SARIF reporter emits region only when line info is available - Report struct carries StartLine/StartColumn from ValidationError - Remove dead getCustomErr function (logic moved into JSON ValidateSyntax) - Add GitHub Action section to README.md and index.md
Use helium ErrorCollector to capture individual validation errors instead of the generic 'xsd: validation failed' message. Errors now include the line number and specific schema violation details.
- Standard: each error on its own indented line - JSON: errors as an array instead of a single joined string - SARIF: each error as its own result entry for per-error annotations - JUnit: each error on its own line within the failure message Add SchemaErrors type to carry individual error messages from JSONSchemaValidate, ValidateXSD, and SARIF schema validation. The CLI populates ValidationErrors slice on Report for reporters to consume.
Reformat helium XSD errors from (string):5: Schemas validity error : Element 'port': ... to line 5: Element 'port': ... Consistent with the error format used by other validators.
- Prefix each validation error with 'syntax:' or 'schema:' to distinguish error types across all reporters - Add ErrorType field to Report struct - Add 'error-type' as a new groupby option that groups results into syntax, schema, and Passed categories - Update flag help text, README, and index
2767e66 to
98a993f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SARIF Region Support, Multi-Error Reporting, and Error Type Classification
This PR adds structured error position data, separates multiple validation errors across all reporters, and introduces error type classification to distinguish syntax from schema failures.
SARIF Inline Annotations
regionwithstartLine/startColumnon each result, enabling GitHub Actions to post inline PR annotations on the affected linesValidationErrortype with optionalLine/ColumnfieldsMulti-Error Separation
Previously, multiple schema validation errors were joined into a single string. Each reporter now handles them individually:
"errors"array instead of a single"error"stringresultentry (one annotation per error)<failure>messageAdded
SchemaErrorstype to carry individual error messages fromJSONSchemaValidate,ValidateXSD, and SARIF schema validation.Error Type Classification
syntax:orschema:across every reporter-groupby error-typeoption groups output intosyntax,schema, andPassedcategories-groupby error-type,filetype)XSD Error Improvements
ErrorCollectorinstead of the generic"xsd: validation failed"(string):5: Schemas validity error : ...toline 5: ...Documentation
Boeing/validate-configs-action@v2.0.0error-type