From: Remi Gacogne Date: Tue, 3 Oct 2023 13:47:04 +0000 (+0200) Subject: clang-tidy.py: We need to output relative paths in annotations X-Git-Tag: rec-5.0.0-alpha2~19^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F13330%2Fhead;p=thirdparty%2Fpdns.git clang-tidy.py: We need to output relative paths in annotations --- 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