Skip to content

Commit 2d2cb77

Browse files
committed
Fix cppcheck filter to match newline before checkers line
Changed regex to \nnofile...\n and replace with \n to properly remove the checkers report line and its surrounding newlines while preserving one trailing newline.
1 parent 299580c commit 2d2cb77

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/test_hooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def run_integration_test(cmd_name, files, args, test_dir, target_output, target_
413413

414414
# Newer cppcheck versions include a checkers report info line
415415
if cmd_name == "cppcheck":
416-
output_actual = re.sub(rb"nofile:0:0: information: Active checkers.*\n", b"", output_actual)
416+
output_actual = re.sub(rb"\nnofile:0:0: information: Active checkers.*\n", b"\n", output_actual)
417417

418418
utils.assert_equal(target_output, output_actual)
419419
assert target_retcode == actual_returncode
@@ -454,7 +454,7 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
454454
actual = re.sub(rb"[\d,]+ warnings and ", b"", actual)
455455
# Newer cppcheck versions include a checkers report info line
456456
if cmd_name == "cppcheck":
457-
actual = re.sub(rb"nofile:0:0: information: Active checkers.*\n", b"", actual)
457+
actual = re.sub(rb"\nnofile:0:0: information: Active checkers.*\n", b"\n", actual)
458458
retcode = sp_child.returncode
459459
utils.assert_equal(target_output, actual)
460460
assert target_retcode == retcode

0 commit comments

Comments
 (0)