Search code examples
c++cmakegitlabcontinuous-integrationcode-climate

Generate Code Climate reports from CMake / clang warnings


We have a large CMake-based C++ project in Gitlab, using Gitlab CI, and it would be really nice to be able to see compiler warnings/errors in the Gitlab UI. To get that to work, it seems Gitlab requires the report to be generated in the codeclimate format.

It seems like it would be fairly straightforward to generate a code climate report from the build logs, but that also seems rather fragile as the output could vary across compilers / compiler versions. It also seems like the sort of integration that someone would have already done and integrated into CMake.

Is there a good way to generate CodeClimate reports from CMake? Ideally I would like it to include clang, gcc, and clang-tidy output.


Solution

  • Check out CodeChecker. It supports analyzing with clang-tidy and parsing the results into a CodeClimate report which is described here: https://codechecker.readthedocs.io/en/latest/gitlab_integration/#using-codechecker-parse