Skip to content

Instantly share code, notes, and snippets.

@amotl
Created December 9, 2020 19:03
Show Gist options
  • Select an option

  • Save amotl/c65936664c78b6023892aa13c65aa4dd to your computer and use it in GitHub Desktop.

Select an option

Save amotl/c65936664c78b6023892aa13c65aa4dd to your computer and use it in GitHub Desktop.
Postprocessing JSON output of Vale using "jq"
# 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,
})
# 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
@amotl
Copy link
Copy Markdown
Author

amotl commented Dec 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment