CI: clang-tidy integration
see https://github.com/battlmonstr/silkworm/commits/clangtidy
TODO:
- fix include header issues
- guard extra includes in compiler_settings.cmake with a special flag
- bring in extra llvm include files somehow
- add more ways to detect clang-tidy in tidy.cmake (e.g. from VCCode/CLion)
- CI script for linux (apt-get install clang-tidy)
- add more check groups and disable slow ones (use --enable-check-profile)
- tweak reporting for CI
WIP here: https://github.com/battlmonstr/silkworm/commits/clangtidy
Instructions:
install clang-tidy into $PATH (e.g. from /Applications/CLion.app/Contents/bin/clang/mac or apt-get install) and CLion in /Applications/CLion.app (for extra macOS include files)
run:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
then:
cmake -P cmake/tidy.cmake
or simply:
clang-tidy -p build cmd/check_pow.cpp
problem:
/Users/daniel/Projects/erigon/silkworm/core/silkworm/common/base.hpp:41:33: error: no member named 'unsigned_integral' in namespace 'std' [clang-diagnostic-error]
concept UnsignedIntegral = std::unsigned_integral<T> || std::same_as<T, intx::uint128> ||
Potentially more issues with missing headers. CMAKE_EXPORT_COMPILE_COMMANDS doesn't seem to export everything that's needed.
cmake -DCMAKE_CXX_CLANG_TIDY=clang-tidy. See https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html.
Done in #1227