New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement]: JUnit reporter for validate command #446
Merged
Conversation
This file contains 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
…current reporters
…orter before reporting "
joshfried-aws
requested review from
akshayrane,
setttings,
Neel-Renavikar,
razcloud,
Brianwithay21,
wkexiang,
brianlaoaws,
reza-aws,
rpdutt and
minhphuong98
January 17, 2024 18:10
minhphuong98
approved these changes
Jan 18, 2024
akshayrane
approved these changes
Jan 18, 2024
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.
Issue #, if available:
#265
Description of changes:
This PR adds a new JUnit reporter. Users can create a junit report similar to how they specify structured json or yaml reports.
To reduce code duplication I did some refactoring in the structured reporter. Building the vector of
RuleFile
structs, and merging the data files with input params is done before delegating the mechanism of reporting (JUnit/JSON/YAML).I implemented a mechanism to get all the failures for a clause, so we can properly output them according to the junit spec. I also decided to add constants for our error codes in an effort to standardize (0 is success, 5 is parse error, 19 is validation failure)
To generate a JUnit report add the following flags when running the CLI
-z -o junit -S none
or
--structured --output junit --show-summary none
Similarly to the JSON and YAML structured reports,
show-summary
must be set to none, and the--structured
flag must be present. This is to prevent polluting the output with plaintext that would break any parser.PLEASE NOTE
Unlike JSON and YAML reports, JUnit reports are only available when using the structured reporter. Attempting to use the junit reporter without specifying the structured flag will result in an error
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license