Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
39e2879
Initial plan
Copilot Feb 23, 2026
311dc01
Add CLANG_TIDY CMake option and enable it in CI
Copilot Feb 23, 2026
21700ea
Remove CodeQL build artifacts and add them to .gitignore
Copilot Feb 23, 2026
9d5bfd8
Merge branch 'main' into copilot/add-cmake-flag-clang-tidy
achamayou Feb 23, 2026
1db0d6e
Apply suggestion from @achamayou
achamayou Feb 23, 2026
129d9b4
Add .clang-tidy config with all checks, warnings as errors, and Forma…
Copilot Feb 23, 2026
02e2456
Curate .clang-tidy checks: enable sensible categories, exclude projec…
Copilot Feb 23, 2026
5d66dbd
Fix clang-tidy errors in test/demo_tree.cpp
Copilot Feb 23, 2026
1b390c1
Fix clang-tidy errors in test/time_large_trees.cpp
Copilot Feb 23, 2026
35229d4
Fix clang-tidy warnings in test/flush.cpp
Copilot Feb 23, 2026
b80121b
Fix clang-tidy errors in test/paths.cpp
Copilot Feb 23, 2026
34dbb5a
Fix clang-tidy errors in test/retract.cpp
Copilot Feb 23, 2026
c71272d
Fix clang-tidy warnings in test/past_root.cpp
Copilot Feb 23, 2026
e65fe00
Fix all clang-tidy errors in test/past_paths.cpp
Copilot Feb 23, 2026
0bd71c5
Fix clang-tidy errors in test/serialisation.cpp
Copilot Feb 23, 2026
fed2e1d
Fix clang-tidy errors in test/partial_serialisation.cpp
Copilot Feb 23, 2026
7f9ec1d
Fix clang-tidy errors in test/serialise_to_file.cpp
Copilot Feb 23, 2026
e10837a
Fix all clang-tidy errors: update .clang-tidy config and fix code issues
Copilot Feb 23, 2026
a02c9f4
Restore retract_to(max_index()) test in retract.cpp with corrected as…
Copilot Feb 23, 2026
9b34a8c
Add CI step to run clang-tidy on merklecpp.h and fix all errors
Copilot Feb 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
Checks: >
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-unhandled-self-assignment,
cert-*,
-cert-err33-c,
-cert-err34-c,
-cert-msc30-c,
-cert-msc32-c,
-cert-msc50-cpp,
-cert-msc51-cpp,
-cert-oop54-cpp,
clang-analyzer-*,
concurrency-*,
-concurrency-mt-unsafe,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-c-copy-assignment-signature,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
hicpp-*,
-hicpp-avoid-c-arrays,
-hicpp-explicit-conversions,
-hicpp-member-init,
-hicpp-no-array-decay,
-hicpp-signed-bitwise,
-hicpp-special-member-functions,
-hicpp-vararg,
misc-*,
-misc-confusable-identifiers,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-misc-unconventional-assign-operator,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-trailing-return-type,
performance-*,
portability-*,
readability-*,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-magic-numbers
WarningsAsErrors: '*'
FormatStyle: file
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Install packages
run: sudo apt install doctest-dev clang
run: sudo apt install doctest-dev clang clang-tidy
if: matrix.os == 'ubuntu-latest'

- uses: actions/checkout@v4
Expand All @@ -47,7 +47,7 @@ jobs:
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DOPENSSL=ON
cmake $GITHUB_WORKSPACE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DOPENSSL=ON -DCLANG_TIDY=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON
fi
Expand All @@ -57,6 +57,11 @@ jobs:
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}

- name: Clang-Tidy Header
if: matrix.os == 'ubuntu-latest'
shell: bash
run: clang-tidy merklecpp.h -p build/${{ matrix.build_type }} --warnings-as-errors='*'

- name: Test
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ option(TESTS "enable testing" OFF)
option(EVERCRYPT "enable comparison with EverCrypt Merkle trees" OFF)
option(OPENSSL "enable OpenSSL" OFF)
option(TRACE "enable debug traces" OFF)
option(CLANG_TIDY "enable clang-tidy checks during build" OFF)

if(CLANG_TIDY)
find_program(CLANG_TIDY_PROGRAM clang-tidy)
if(CLANG_TIDY_PROGRAM)
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_PROGRAM})
set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_PROGRAM})
else()
message(FATAL_ERROR "clang-tidy not found")
endif()
endif()

add_library(merklecpp INTERFACE)
target_include_directories(merklecpp INTERFACE .)
Expand Down
Loading
Loading