Skip to content

Instantly share code, notes, and snippets.

@laidback
Created March 16, 2020 09:47
Show Gist options
  • Select an option

  • Save laidback/b2e7a0ea88d16686705c39eeba6798bd to your computer and use it in GitHub Desktop.

Select an option

Save laidback/b2e7a0ea88d16686705c39eeba6798bd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# create the base lint result
spectral lint --quiet --format json --output lint.json code/build/api-spec/openapi3.yaml
# process to code quality format
jq -c '[.[] | { description: .message, original: ., location: { path: .source, lines: { begin: .range.start.line }}}]' lint.json > base.json
jq -c '.[]' base.json | while read -r line ; do
sum=$(echo "$line" | md5sum | cut -d' ' -f1);
jq -r 'del(.original)' <<< $line |
jq -r --arg sum "$sum" '. + {fingerprint: $sum}' >> code/processed.json
done
cat code/processed.json | jq -s > code/codequality.json
cat code/codequality.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment