Skip to content

Commit 0e989e6

Browse files
authored
Merge pull request #883 from stephenswat/ci/check_taboos
Add pre-commit hook to check for detray units
2 parents a839774 + e403c79 commit 0e989e6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/check_taboos.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
if ! [ -x "$(command -v rg)" ]; then
4+
GREP="grep -R"
5+
else
6+
GREP="rg -j 1 --no-heading -N"
7+
fi
8+
9+
INPUT="$@"
10+
11+
INPUT_EX_THIS_FILE=${INPUT[@]/".github/check_taboos.sh"}
12+
13+
UNIT_CONSTANT_EXCUDE_FILE="core/include/traccc/definitions/common.hpp"
14+
INPUT_EX_UNIT_CONSTANT=${INPUT_EX_THIS_FILE[@]/$UNIT_CONSTANT_EXCUDE_FILE}
15+
16+
${GREP} "detray::unit" ${INPUT_EX_UNIT_CONSTANT[@]} ; test $? -eq 1 || exit 1
17+
${GREP} "detray::constant" ${INPUT_EX_UNIT_CONSTANT[@]} ; test $? -eq 1 || exit 1
18+
19+
TRACK_PARAMS_EXCLUDE_FILE="core/include/traccc/edm/track_parameters.hpp"
20+
INPUT_EX_TRACK_PARAMS=${INPUT_EX_THIS_FILE[@]/$TRACK_PARAMS_EXCLUDE_FILE}
21+
22+
${GREP} "detray::free_track_parameters" ${INPUT_EX_TRACK_PARAMS[@]} ; test $? -eq 1 || exit 1
23+
${GREP} "detray::bound_track_parameters" ${INPUT_EX_TRACK_PARAMS[@]} ; test $? -eq 1 || exit 1
24+
${GREP} "detray::bound_vector" ${INPUT_EX_TRACK_PARAMS[@]} ; test $? -eq 1 || exit 1
25+
${GREP} "detray::bound_matrix" ${INPUT_EX_TRACK_PARAMS[@]} ; test $? -eq 1 || exit 1

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ repos:
1212
name: Check includes with quotes
1313
language: system
1414
entry: .github/check_quote_includes.sh
15+
16+
- repo: local
17+
hooks:
18+
- id: check_taboos
19+
name: Check taboo code patterns
20+
language: system
21+
entry: .github/check_taboos.sh

0 commit comments

Comments
 (0)