Skip to content

[ci] Implementing a Code Quality portion of the CI tests via cpplint

Lawrence Lee Jr requested to merge leejr/Ph2_ACF:ci/cpplint into Dev

After quickly discussing with @fravera this morning, I'd like to propose adding a code quality step in the CI. This is something we implemented in my last project to enforce style uniformity, clarity of code, etc. This is using cpplint which enforces Google's C++ style standards.

The new quality stage of the CI currently contains two jobs:

  • quality:cpplint runs cpplint on all C++ sources and saves the outputs in a JSON that is minimally compliant with the Code Climate spec.
  • code_quality allows for future merging of multiple JSONs (from other tools or perhaps eventually containing the compilation warnings) and then publishes the artifact in a way that exposes it to GitLab.

When looking at the relevant pipeline, a new tab will show up containing a code quality report:

The merge request interface will read in the code quality reports of the source and target branches and diff them for the reviewer. So it will show how the number of issues has changed, which items have been fixed and which new ones have been introduced. (The interface will not show up on this MR, but will show up in the first MR submitted after this is merged, as long as the source branch is up to date.)

In the future, a policy can be instituted where a MR may not increase the total number of linter issues such that the project slowly tends towards improvement.

Happy to hear what people think! And in the future, we can add additional tests in this way such that they're published to the MR interface in this very useful way.

cc @enibigir

Merge request reports