Skip to content

build(clang-tidy): replace clang-tidy scripts with CMake approach#142

Merged
ingomueller-net merged 1 commit intosubstrait-io:mainfrom
ingomueller-net:revamp-clang-tidy
Mar 26, 2026
Merged

build(clang-tidy): replace clang-tidy scripts with CMake approach#142
ingomueller-net merged 1 commit intosubstrait-io:mainfrom
ingomueller-net:revamp-clang-tidy

Conversation

@ingomueller-net
Copy link
Copy Markdown
Contributor

This PR replaces the clang-tidy scripts with a CMake-based approach. The core mechanism is to define CMake's CMAKE_CXX_CLANG_TIDY variable, which invokes clang-tidy whenever a C++ target is compiled. The remainder consists of some logic that finds the clang-tidy executable and its arguments as well as activating and deactivating the command in the right place (in particular, to exclude checking third-party code).

I see three main advantages to the new approach: (1) The new logic is considerably simpler than the previous scripts. (2) The code is automatically checked when it compiled, potentially saving round-trips through CI. (3) We save an extra 10 minutes on CI for recompiling the whole project, which the previous scripts did.

The PR also does two minor changes: (1) It removes the AnalyzeTemporaryDtors configuration, which was depcrecated in clang 16 and removed in clang 18. (2) It applies the suggested fixes for one class of errors that my clang-tidy-22 complained about.

This PR replaces the clang-tidy scripts with a CMake-based approach. The
core mechanism is to define CMake's `CMAKE_CXX_CLANG_TIDY` variable,
which invokes clang-tidy whenever a C++ target is compiled. The
remainder consists of some logic that finds the clang-tidy executable
and its arguments as well as activating and deactivating the command in
the right place (in particular, to exclude checking third-party code).

I see three main advantages to the new approach: (1) The new logic is
considerably simpler than the previous scripts. (2) The code is
automatically checked when it compiled, potentially saving round-trips
through CI. (3) We save an extra 10 minutes on CI for recompiling the
whole project, which the previous scripts did, this brings the `check`
CI job down to about 1 minute.

The PR also does three minor changes: (1) It removes the
`AnalyzeTemporaryDtors` configuration, which was depcrecated in clang 16
and removed in clang 18. (2) It applies the suggested fixes for one
class of errors that my clang-tidy-22 complained about. (3) It disables
the tests of the protobuf-matchers dependency, which were meant to be
disabled, but in a way that didn't work. Note that that latter point
will be obsolete with substrait-io#139.

Signed-off-by: Ingo Müller <ingomueller@google.com>
@ingomueller-net ingomueller-net marked this pull request as ready for review March 26, 2026 12:33
@ingomueller-net ingomueller-net enabled auto-merge (squash) March 26, 2026 12:33
@ingomueller-net ingomueller-net merged commit 74fcf18 into substrait-io:main Mar 26, 2026
4 checks passed
@ingomueller-net ingomueller-net deleted the revamp-clang-tidy branch March 26, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants