-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json-Output #243
Comments
Hello @strowi, have you searched similar issues before opening this one? |
Hi @adrienverge, i only found this ~3y old one regarding json? After reading the codeclimate-specs again, it seems, they require every issue to be json, but separate issues by "\0", which is not json-compliant. So i guess this would require a separate codeclimate-format? |
yamllint has support for GitHub. Similarly to GitHub, the cloud service GitLab supports reading output in the "codeclimate" format. Wouldn't this be comparable to the GitHub support? |
Many could be comparable to the GitHub support. Similarly, we could accept dozens of formats with the same argument. For this reason, there won't be new third-party formats added. |
In case someone else comes across this issue when searching for gitlab codeclimate/codequality output, I found this project: https://github.com/ProfessorManhattan/codeclimate-yamllint
I had to change it a bit to get valid json from it but I ended up with this: lint:
stage: lint
script:
- mkdir reports
- >
yamllint -f parsable . | tee >(awk '
BEGIN {FS = ":"; ORS="\n"; first=1}
{
gsub(/^[ \t]+|[ \t]+$|"/, "", $4);
match($4, /^\[(warning|error)\](.*)\((.*)\)$/, a);
sev = (a[1] == "error" ? "major" : "minor");
if (first) {
first=0;
printf("[");
} else {
printf(",");
}
printf("{\"location\":{\"path\":\"%s\",\"lines\":{\"begin\":%s,\"end\":%s}}," \
"\"severity\":\"%s\",\"check_name\":\"%s\",\"categories\":[\"Style\"]," \
"\"type\":\"issue\",\"description\":\"%s\"}",
$1, $2, $3, sev, a[3], a[2]);
}
END { if (!first) printf("]\n"); }' > reports/codequality.json)
artifacts:
when: always
paths:
- reports
expire_in: 1 week
reports:
codequality: reports/codequality.json
How about going the same route as flake8 and offloading the formatters to plugins? |
Hi,
since we are using gitlab and its codeclimate integration, we really would like json-formatted output.
Would you be willing to accept an MR adding json-output adhering to the codeclimate spec ?
-> https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#output
Ideally this would include the severity:
But this would be a breaking change i guess? Since it's optional it could be left out..
regards,
strowi
The text was updated successfully, but these errors were encountered: