Skip to content
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

Add required field to CodeClimate export for GitLab code quality job #3342

Open
jmalmari opened this issue Jun 3, 2021 · 1 comment
Open
Labels
CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands

Comments

@jmalmari
Copy link

jmalmari commented Jun 3, 2021

CodeClimate export of CodeChecker parse (and maybe others) doesn't produce as complete JSON as it could. Its array elements are missing a severity field which makes them not load in GitLab code quality widget. As severity information is readily available it would be quite easy to add it.

A GitLab CI job might do the following:

  1. CodeChecker analyze -o ./reports compile_commands.json
  2. CodeChecker parse ./reports -e codeclimate >codeclimate.json

The output doesn't qualify as a proper GitLab code quality report. The reason is that in GitLab the severity field is required whereas CodeClimate specification declares it optional. Relevant documentation:

Example diff of the wanted JSON file:

[
 {
    "type": "issue",
    "check_name": "deadcode.DeadStores",
    "description": "Value stored to 'buffer' is never read",
    "categories": [ "Bug Risk" ],
    "fingerprint": "1421455f5cc176089ded56749a5d6535",
+    "severity": "minor",
    "location": { "path": "foo.c",  "lines": { "begin": 32 } }
  }
]

I made a proof of concept that works for my purposes: jmalmari/codechecker@ca9f9339

@csordasmarton csordasmarton added the CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands label Jun 11, 2021
@csordasmarton
Copy link
Contributor

@jmalmari Can you please create a pull request from your branch to our repository? So we can review it more easily and we can merge it inside our repository 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands
Projects
None yet
Development

No branches or pull requests

2 participants