Run coverity and clang-tidy on EleFits
Opened this issue · 1 comments
Here is the procedure to perform static analysis of Elefits project using coverity and clang-tidy.
Coverity scanner
Follow EleFits installation procedure until the make
command and then run the make command using the coverity-build tool that should be downloaded on coverity website (compilation takes more time of course)
- Configure
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/usr/local ..
Create directory to store coverity analyser:
mkdir cov-int
Run coverity build tool and make command (not make install):
cov-build --dir cov-int make -j10
In this case build is done with using 10 threads.
- Compress coverity analysis:
tar czvf elefits.tgz cov-int
- Upload results to coverity server (manually):
https://scan.coverity.com/projects/elefits
It can be automated locally using coverity-submit or by integrating it in github (github actions? Travis CI?)
clang-tidy
- Configure Elefits and generate compilation database with cmake to let clang tools figure out specific build options:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/usr/local ..
- Use run-clang-tidy script to run clang-tidy over all files in a compilation database:
run-clang-tidy-13 -p . -j 10 -export-fixes clang-tidy-fixes.log ../Ele*
In this case clang-tidy runs without default checks, with 10 threads in parallel and export errors/fixes to clang-tidy-fixes.log file
attached in the issue:
clang-tidy-fixes.log
TODO: Compile Elements and Elefits with clang before running clang-tidy.
I give also a try to CodeFactor service (I've seen that it is used by Alexandria project):
https://www.codefactor.io/repository/github/cnes/elefits/overview/develop
The easiest to setup but don't know if it is relevant (mostly style issues which can be skipped)