Skip to content

enh(ci): add static analysis

Lucas SCHMIDT requested to merge 47-ci-add-static-analysis into dev

Description

A lot of time is spent during review to spot mistakes that could be detected automatically by a static analysis tool. CppCheck was disabled in the CI because it took too much time to run, however it takes only 2 minutes on my machine to scan the whole Sight library, so I believe it can be re-enabled. I tested on an MR with 33 C++ file changes, it takes only 28 seconds to run, which is pretty fast. I also tested with around 2500 C++ file changes (nearly all Sight) and it only takes 7 minutes to run, which is pretty fast as well.

I will also add Clang-Tidy on the CI, however it requires a compile_commands.json to work, which only CMake can generate, as such it can't be added as a Sheldon hook. I will add it directly on Sight CI script in a Sight MR.

Closes #47 (closed)

How to test it?

Run the cppcheck hook. It should manage to run and display useful messages, without false positives.

Additional tests/tasks to run

  • Check if it runs in a reasonable time on the Sight CI
  • Add Clang-Tidy on the CI as well (not possible as a Sheldon hook, must be directly on the Sight CI script)
Edited by Lucas SCHMIDT

Merge request reports