"""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)
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:
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