From af80bb723567fbb5510ace3623bce6c35396ac5a Mon Sep 17 00:00:00 2001 From: Sandy Date: Wed, 10 Jan 2024 15:37:23 -0500 Subject: [PATCH] Use posix slashes when looking up files from PR changeset This fixes the "Skipping comment for file" warning that was indexing with paths with backslashes on windows. --- post/clang_tidy_review/clang_tidy_review/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/post/clang_tidy_review/clang_tidy_review/__init__.py b/post/clang_tidy_review/clang_tidy_review/__init__.py index 1273206..31bc672 100644 --- a/post/clang_tidy_review/clang_tidy_review/__init__.py +++ b/post/clang_tidy_review/clang_tidy_review/__init__.py @@ -548,7 +548,7 @@ def format_diff_line(diagnostic, offset_lookup, source_line, line_offset, line_n return code_blocks, end_line -def try_relative(path): +def try_relative(path) -> pathlib.Path: """Try making `path` relative to current directory, otherwise make it an absolute path""" try: here = pathlib.Path.cwd() @@ -686,7 +686,7 @@ def create_review_file( notes=diagnostic.get("Notes", []), ) - rel_path = str(try_relative(get_diagnostic_file_path(diagnostic, build_dir))) + rel_path = try_relative(get_diagnostic_file_path(diagnostic, build_dir)).as_posix() # diff lines are 1-indexed source_line = 1 + find_line_number_from_offset( offset_lookup,