-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put clang-tidy into thin wrapper script
Otherwise we are not able to use the shell to dynamically get things
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Thin wrapper around clang-tidy that we need to make sure that we can pass the | ||
# include directories for SIO to clang-tidy as it seems that it's not always | ||
# present in the compile database that is generated by CMake. This is mainly | ||
# necessary for template heavy header only parts that get included and for which | ||
# clang-tidy runs into a clang-diagnostic-error because it cannot find an SIO | ||
# header. We cannot do this in the pre-commit configuration because we cannot do | ||
# any shell expansion there. | ||
|
||
# Safe guard against environments where we do not have SIO available. The | ||
# clang-tidy checks will probably fail, but at least we are not getting problems | ||
# with passing garbage as extra arguments | ||
EXTRA_ARGS="" | ||
if which sio-dump > /dev/null 2>&1; then | ||
EXTRA_ARGS="--extra-arg=-I$(realpath $(dirname $(which sio-dump))/../include)" | ||
fi | ||
|
||
clang-tidy -warnings-as-errors='*,-clang-diagnostic-deprecated-declarations' -p compile_commands.json $EXTRA_ARGS ${@} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters