@@ -266,7 +266,7 @@ def merge_replacement_files(tmpdir: Path, mergefile: Path):
266
266
yaml .safe_dump (output , out )
267
267
268
268
269
- def load_clang_tidy_warnings (fixes_file ) -> Dict :
269
+ def load_clang_tidy_warnings (fixes_file : Path ) -> Dict :
270
270
"""Read clang-tidy warnings from fixes_file. Can be produced by build_clang_tidy_warnings"""
271
271
try :
272
272
with fixes_file .open () as f :
@@ -955,9 +955,7 @@ def create_review(
955
955
files = filter_files (diff , include , exclude )
956
956
957
957
if files == []:
958
- with message_group ("No files to check!" ), Path (REVIEW_FILE ).open (
959
- "w"
960
- ) as review_file :
958
+ with message_group ("No files to check!" ), REVIEW_FILE .open ("w" ) as review_file :
961
959
json .dump (
962
960
{
963
961
"body" : "clang-tidy found no files to check" ,
@@ -972,7 +970,7 @@ def create_review(
972
970
973
971
line_ranges = get_line_ranges (diff , files )
974
972
if line_ranges == "[]" :
975
- with message_group ("No lines added in this PR!" ), Path ( REVIEW_FILE ) .open (
973
+ with message_group ("No lines added in this PR!" ), REVIEW_FILE .open (
976
974
"w"
977
975
) as review_file :
978
976
json .dump (
@@ -1071,7 +1069,7 @@ def create_review(
1071
1069
review = create_review_file (
1072
1070
clang_tidy_warnings , diff_lookup , offset_lookup , build_dir
1073
1071
)
1074
- with Path ( REVIEW_FILE ) .open ("w" ) as review_file :
1072
+ with REVIEW_FILE .open ("w" ) as review_file :
1075
1073
json .dump (review , review_file )
1076
1074
1077
1075
return review
@@ -1111,23 +1109,25 @@ def download_artifacts(pull: PullRequest, workflow_id: int):
1111
1109
1112
1110
metadata = (
1113
1111
json .loads (data .read (str (METADATA_FILE )))
1114
- if METADATA_FILE in filenames
1112
+ if str ( METADATA_FILE ) in filenames
1115
1113
else None
1116
1114
)
1117
1115
review = (
1118
- json .loads (data .read (str (REVIEW_FILE ))) if REVIEW_FILE in filenames else None
1116
+ json .loads (data .read (str (REVIEW_FILE )))
1117
+ if str (REVIEW_FILE ) in filenames
1118
+ else None
1119
1119
)
1120
1120
return metadata , review
1121
1121
1122
1122
1123
1123
def load_metadata () -> Optional [Metadata ]:
1124
1124
"""Load metadata from the METADATA_FILE path"""
1125
1125
1126
- if not pathlib . Path ( METADATA_FILE ) .exists ():
1126
+ if not METADATA_FILE .exists ():
1127
1127
print (f"WARNING: Could not find metadata file ('{ METADATA_FILE } ')" , flush = True )
1128
1128
return None
1129
1129
1130
- with Path ( METADATA_FILE ) .open () as metadata_file :
1130
+ with METADATA_FILE .open () as metadata_file :
1131
1131
return json .load (metadata_file )
1132
1132
1133
1133
@@ -1136,7 +1136,7 @@ def save_metadata(pr_number: int) -> None:
1136
1136
1137
1137
metadata : Metadata = {"pr_number" : pr_number }
1138
1138
1139
- with Path ( METADATA_FILE ) .open ("w" ) as metadata_file :
1139
+ with METADATA_FILE .open ("w" ) as metadata_file :
1140
1140
json .dump (metadata , metadata_file )
1141
1141
1142
1142
@@ -1154,7 +1154,7 @@ def load_review(review_file: pathlib.Path) -> Optional[PRReview]:
1154
1154
1155
1155
def load_and_merge_profiling () -> Dict :
1156
1156
result = {}
1157
- for profile_file in Path ( PROFILE_DIR ) .glob ("*.json" ):
1157
+ for profile_file in PROFILE_DIR .glob ("*.json" ):
1158
1158
profile_dict = json .load (profile_file .open ())
1159
1159
filename = profile_dict ["file" ]
1160
1160
current_profile = result .get (filename , {})
0 commit comments