Example of the creating markdown table from the gl-code-quality-report.json
Gitlab's code quality report with codeclimate SPEC.
- Install
jq
- Run the next command to convert
gl-code-quality-report.json
to markdown:jq -r '. | sort_by((.location.path | explode | map(-.)), .location.lines.begin) | .[] | @text "| [\(.location.path):\(.location.lines.begin)](../blob/BRANCH-NAME/\(.location.path)#L\(.location.lines.begin)) | \(.description)"' gl-code-quality-report.json
- Add table header to the beggigning of the output:
| Path | Description | | --- | --- |
Click to expand the output example
Path | Description |
---|---|
app/app_test.go:8 | goimports: File is not goimports -ed |
app/app_test.go:87 | golint: should drop = 0 from declaration of var counter; it is the zero value |
My codeclimat's json report, write at start some notice:
Exclude any elemnt doesn't contains 'type = issue'
jq -r '. | map(select(.type | test("issue"; "i"))) | sort_by((.location.path | explode | map(-.)), .location.lines.begin) | .[] | @text "| (.location.path):(.location.lines.begin)#L(.location.lines.begin)) | (.description)"' gl-code-quality-report.json