Skip to content

Commit bb01cc1

Browse files
committed
Fix clang-tidy --fix-errors expected return code
Newer clang-tidy returns 0 when using --fix-errors, even if errors cannot be fixed. Updated test to expect return code 0 for error files with --fix-errors flag.
1 parent 053da01 commit bb01cc1

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
@@ -142,10 +142,11 @@ def generate_clang_tidy_tests(cls):
142142
new_arg_set[new_arg_set.index("-std=c18")] = "-std=c++20"
143143
# Clang tidy c++20 generates additional warnings
144144
# When --fix-errors is used, newer clang-tidy produces no output for unfixable errors
145-
# (but -fix still produces error output)
145+
# and returns 0 (but -fix still produces error output and returns 1)
146146
has_fix_errors_flag = "--fix-errors" in new_arg_set
147147
expected_output = b"" if (has_fix_errors_flag and i >= 2) else clang_tidy_output[i]
148-
clang_tidy_scenario = [ClangTidyCmd, new_arg_set, [cls.files[i]], expected_output, cls.retcodes[i]]
148+
expected_retcode = 0 if (has_fix_errors_flag and i >= 2) else cls.retcodes[i]
149+
clang_tidy_scenario = [ClangTidyCmd, new_arg_set, [cls.files[i]], expected_output, expected_retcode]
149150
scenarios += [clang_tidy_scenario]
150151
return scenarios
151152

0 commit comments

Comments
 (0)