From 9a67feab168b35f2d5c7bc324ea0ff6aa29971b9 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 3 Oct 2023 15:47:04 +0200 Subject: [PATCH] clang-tidy.py: We need to output relative paths in annotations --- .github/scripts/clang-tidy.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/scripts/clang-tidy.py b/.github/scripts/clang-tidy.py index 856be887f6..4fafc03e16 100755 --- a/.github/scripts/clang-tidy.py +++ b/.github/scripts/clang-tidy.py @@ -33,6 +33,7 @@ def main(): """Start the script.""" args = create_argument_parser() + repo_root_dir = Path(helpers.get_repo_root()) fixes_path = Path(args.fixes_file) compdb_filename = os.path.join(fixes_path.parent, "compile_commands.json") compdb = helpers.load_compdb(compdb_filename) @@ -67,14 +68,6 @@ def main(): else os.path.join(directory, filename) ) - if full_filename not in compdb: - print( - f"Skipping `{full_filename}`" - " because it is not found" - " in the compilation database" - ) - continue - try: file_contents = helpers.load_file(full_filename) except OSError: @@ -85,16 +78,17 @@ def main(): line = helpers.get_line_from_offset(file_contents, offset) + relative_filename = Path(full_filename).resolve().relative_to(repo_root_dir) annotation = "".join( [ - f"::warning file={full_filename},line={line}", + f"::warning file={relative_filename},line={line}", f"::{message} ({name} - Level={level})", ] ) print(annotation) # User-friendly printout - print(f"{level}: {full_filename}:{line}: {message} ({name})") + print(f"{level}: {relative_filename}:{line}: {message} ({name})") have_warnings = True -- 2.47.2