Skip to content

Commit ef14844

Browse files
committed
fix: propagate clang-tidy failures in lint.sh
Track lint failures and exit non-zero when clang-tidy reports issues so CI and pre-push hooks can catch them. Also switch from piped while-loop to process substitution so the failure flag propagates correctly.
1 parent 6784943 commit ef14844

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

scripts/lint.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ BUILD_DIR="${PROJECT_ROOT}/build"
2525

2626
log_info "Running clang-tidy over source files..."
2727

28-
find "${PROJECT_ROOT}/src" "${PROJECT_ROOT}/tests" -type f \( -name '*.cpp' -o -name '*.cxx' -o -name '*.cc' \) | while read -r file; do
28+
LINT_FAILED=0
29+
30+
while IFS= read -r file; do
2931
log_step "$file"
30-
clang-tidy "$file" -p "$BUILD_DIR" || true
31-
done
32+
if ! clang-tidy "$file" -p "$BUILD_DIR"; then
33+
LINT_FAILED=1
34+
fi
35+
done < <(find "${PROJECT_ROOT}/src" "${PROJECT_ROOT}/tests" -type f \( -name '*.cpp' -o -name '*.cxx' -o -name '*.cc' \))
36+
37+
if [ "$LINT_FAILED" -ne 0 ]; then
38+
log_error "clang-tidy found issues."
39+
exit 1
40+
fi
3241

3342
log_info "clang-tidy lint complete."

0 commit comments

Comments
 (0)