Skip to content

Commit 53e9046

Browse files
committed
Initialize filtered_system_headers from warnings count filtering
If we filter 'X warnings generated.' message, that indicates system header warnings were present. Initialize filtered_system_headers to True in this case to enable return code normalization.
1 parent d0f8fca commit 53e9046

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/test_hooks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,15 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
464464
actual = re.sub(rb"[\d,]+ warnings and ", b"", actual)
465465
# Filter out "X warnings generated." from clang-tidy (macOS with SDK configured)
466466
if cmd_name == "clang-tidy":
467-
# Filter warnings count
467+
# Filter warnings count and track if we filtered it
468468
filtered_actual = re.sub(rb"\d+ warnings? generated\.\n", b"", actual)
469+
filtered_warnings_count = (filtered_actual != actual)
469470
# Filter errors from macOS SDK system headers
470471
lines = filtered_actual.split(b"\n")
471472
filtered_lines = []
472473
skip_next_error_processing = False
473474
in_system_header_error = False
474-
filtered_system_headers = False # Track if we filtered any system header content
475+
filtered_system_headers = filtered_warnings_count # Track if we filtered any system header content
475476
for i, line in enumerate(lines):
476477
# Skip lines containing macOS SDK paths
477478
if b"/Applications/Xcode" in line and b"/MacOSX.sdk/" in line:

0 commit comments

Comments
 (0)