silkworm icon indicating copy to clipboard operation
silkworm copied to clipboard

CI: clang-tidy integration

Open battlmonstr opened this issue 3 years ago • 2 comments

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

battlmonstr avatar Sep 06 '22 10:09 battlmonstr

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.

battlmonstr avatar Sep 06 '22 10:09 battlmonstr

cmake -DCMAKE_CXX_CLANG_TIDY=clang-tidy. See https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html.

chfast avatar Sep 09 '22 13:09 chfast

Done in #1227

canepat avatar Mar 08 '24 08:03 canepat