enh(ci): add static analysis
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)
Merge request reports
Activity
changed milestone to %sight 22.0
added Priorityhigh Themeci Typefeature labels
requested review from @dweckmann and @fbridault
assigned to @lschmidt
added 2 commits
added 10 commits
-
be17cb76...df573015 - 3 commits from branch
dev
- 799dca13 - enh(ci): reenable cppcheck in the CI
- 8d7d2888 - style: fix flake8 errors
- 63c19f97 - misc: add HTML report for CppCheck
- 5cda0251 - misc: fix problems with CppCheck
- f915f330 - misc: make flake8 happy
- 4d5b064b - misc: fix CppCheck hook documentation
- ee071e0b - misc: add possibility to change report mode
Toggle commit list-
be17cb76...df573015 - 3 commits from branch
added 1 commit
- 27efae0d - misc: ignore CppCheck hook if there are no C++ files
mentioned in issue sight#880 (closed)