Created
March 16, 2020 09:47
-
-
Save laidback/b2e7a0ea88d16686705c39eeba6798bd to your computer and use it in GitHub Desktop.
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
| #!/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