Created
December 9, 2020 19:03
-
-
Save amotl/c65936664c78b6023892aa13c65aa4dd to your computer and use it in GitHub Desktop.
Postprocessing JSON output of Vale using "jq"
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
| # Summarize JSON output of Vale using jq. | |
| # cat vale-report.json | jq --from-file vale-summary.jq > vale-summary.json | |
| to_entries | map({ | |
| file: .key, | |
| errors: .value | [ .[] | select(.Severity | contains("error")) ] | length, | |
| warnings: .value | [ .[] | select(.Severity | contains("warning")) ] | length, | |
| suggestions: .value | [ .[] | select(.Severity | contains("suggestion")) ] | length, | |
| }) |
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
| # Reformat JSON summary of Vale to CSV using jq. | |
| # cat vale-summary.json | jq --raw-output --from-file vale-summary2csv.jq > vale-summary.csv | |
| # Define header columns | |
| ["file", "errors", "warnings", "suggestions"], | |
| # Define rows | |
| (.[] | [.file, .errors, .warnings, .suggestions]) | |
| # Format as CSV | |
| | @csv |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also crate/crate-docs#46 and vale-cli/vale#286.