mqtt_cpp icon indicating copy to clipboard operation
mqtt_cpp copied to clipboard

Add more static analysis to CI

Open jonesmz opened this issue 5 years ago • 2 comments

E.g this blog post has great info on how to use cmake to do some great static anlysis.

https://blog.kitware.com/static-checks-with-cmake-cdash-iwyu-clang-tidy-lwyu-cpplint-and-cppcheck/

I've set up the following on some of my projects:

"link what you use"

cmake -DCMAKE_LINK_WHAT_YOU_USE=TRUE .
cmake --build . --target all

include what you use:

cmake -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=/usr/lib/llvm/8/bin/include-what-you-use .
cmake --build . --target all

clang tidy

cmake -DCMAKE_CXX_CLANG_TIDY=/usr/lib/llvm/8/bin/clang-tidy .
cmake --build . --target all

clang static analyzer (different than clang tidy)

export PATH="/usr/lib/llvm/8/bin:$PATH"
scan-build -o scanlogs cmake -DCMAKE_BUILD_TYPE=Debug .
scan-build -o scanlogs make -j `nproc`

jonesmz avatar Dec 30 '19 07:12 jonesmz

@jonesmz , it seems good. Could you write a PR to support the feature?

redboltz avatar Jan 08 '20 03:01 redboltz

Sure.

Will try.

jonesmz avatar Jan 08 '20 03:01 jonesmz