From 5e5f3746db875e33fa1be408b2ec693180475025 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Wed, 6 Sep 2023 23:08:17 +0100 Subject: [PATCH] check-style: Fix trailing whitespace column indicator in verbose mode --- utils/check-style-clang-format.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/check-style-clang-format.py b/utils/check-style-clang-format.py index 04919a90a..f082d878e 100755 --- a/utils/check-style-clang-format.py +++ b/utils/check-style-clang-format.py @@ -489,10 +489,12 @@ def check_trailing_whitespace_file(filename: str, file_lines[i] = line_fixed if verbose: + line_fixed_stripped_expanded = line_fixed.rstrip().expandtabs(TAB_SIZE) + verbose_infos.extend([ - f'{filename}:{i + 1}: error: Trailing whitespace detected', - f' {line_fixed.rstrip()}', - f' {"":{len(line_fixed) - 1}}^', + f'{filename}:{i + 1}:{len(line_fixed_stripped_expanded) + 1}: error: Trailing whitespace detected', + f' {line_fixed_stripped_expanded}', + f' {"":{len(line_fixed_stripped_expanded)}}^', ]) # Optimization: If running in non-verbose check mode, only one error is needed to check that the file is not compliant