Integration of Clang-Tidy into CI
Notes
- Developer codes should be updated from up to date commit on master 602b6715 (I merged into Fix-CI-testjobs branch to avoid headaches with clang-tidy discovering new problems once merged into master)
- Updates not deployed to homeworks yet!
The pipeline now
- Async. jobs according to dependency graph
- Total pipeline takes about 30min max
Clang-Tidy
- Custom list of checks that I deemed useful
- Some checks had to be left out due to many false positives (e.g. const correctness) or because they didn't play well with Eigen
- Treat warnings as errors:
- Pro: Forces developers to handle warnings, otherwise we may just get a sea of warnings some months down the line that nobody bothers to sift through anymore
- Con: Future developers will be forced to sometimes add
// NOLINT(<check>)
to handle erroneous warnings (e.g. variables only used in assert-like statements are viewed as unused parameters!)
- Only developers folder is checked! I left out lecturecodes as I deemed them less important to check (though I could add them)
- LLVM's parallel clang-tidy script can also apply autofixes but I've found it to be a little buggy unfortunately. It can do parallelized checks for the pipeline though.
Overall clang-tidy discovered useful problems imo, e.g. inconsistent variable names between function declarations and definitions.
std::system
calls
Custom check for Since clang-tidy doesn't allow creating custom checks in a simple way, I just created a bash script that returns an error if it finds a std::system
call within the developers folder. It also shows where it found it.
(Recall that we want to forbid std::system
as it throws no error when the system call fails so a pipeline would still pass. We have a wrapper function that takes care of this now)