CI: Add manual pre-commit hook for clang-tidy
#93271
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #90219
Implements a manual hook for clang-tidy, allowing one to utilize clang-tidy without needing separate downloads beyond pre-commit itself. The reason for specifying that it's a "manual" hook is because this type of hook is not automatically invoked; instead, it must be called directly via
pre-commit run --hook-stage manual clang-tidy
(a comment was added to.pre-commit-config.yaml
explaining this). This integration renderedmisc/scripts/clang_tidy.sh
redundant, so it's been removed.Additionally, the
.clang-tidy
file has been given modernized yaml syntax.CheckOptions
functions like an implicit dictionary, not needing nearly as many bounding quotes; the only options present are the ones that we've explicitly changed.Checks
has been transformed into a multi-line string, making future changes much more obvious for version control.HeaderFileExtensions
andImplementationFileExtensions
were added to specify the checked extension types in.pre-commit-config.yaml
.FormatStyle
was changed tofile
, so there no longer needs to be a second-pass of clang-format.HeaderFilterRegex
was changed to an anti-pattern excluding the thirdparty folder; can be simplified to utilizeExcludeHeaderFilterRegex
once v19 is released.