@@ -128,8 +128,8 @@ def _get_possible_pr_files(
128
128
path = Path (filename )
129
129
130
130
# If the path is relative, it shouldn't contain intermediate `..`s.
131
- first_non_dot_idx = next ((i for i , part in enumerate (path .parts ) if part != ".." ), 0 )
132
- path = Path (* path .parts [first_non_dot_idx :])
131
+ first_idx_non_dots = next ((idx for idx , part in enumerate (path .parts ) if part != ".." ))
132
+ path = Path (* path .parts [first_idx_non_dots :])
133
133
if ".." in path .parts :
134
134
raise ValueError (
135
135
f"Found `..` in the middle of path. Encoded location: { warning .encoded_location } "
@@ -142,18 +142,18 @@ def _get_possible_pr_files(
142
142
}
143
143
144
144
# Make possible variations of the pr files' paths
145
- pr_file_by_filepath : dict [str , PrFile ] = {}
145
+ pr_file_by_filepath_variation : dict [str , PrFile ] = {}
146
146
for pr_file in pr_files :
147
147
pr_path = Path (pr_file .filename )
148
- pr_file_by_filepath [pr_path .as_posix ()] = pr_file
148
+ pr_file_by_filepath_variation [pr_path .as_posix ()] = pr_file
149
149
for truncated in self ._left_truncated_paths (pr_path , max_num_paths = 1 ):
150
- pr_file_by_filepath [truncated ] = pr_file
150
+ pr_file_by_filepath_variation [truncated ] = pr_file
151
151
152
152
# Find all matching PR files
153
- matching_pr_files = []
154
- for path in warning_filepath_variations :
155
- if path in pr_file_by_filepath :
156
- matching_pr_files .append (pr_file_by_filepath [ path ])
153
+ matching_pr_files : list [ PrFile ] = []
154
+ for filepath in warning_filepath_variations :
155
+ if filepath in pr_file_by_filepath_variation :
156
+ matching_pr_files .append (pr_file_by_filepath_variation [ filepath ])
157
157
158
158
if matching_pr_files :
159
159
self .logger .debug (
@@ -166,7 +166,7 @@ def _get_possible_pr_files(
166
166
167
167
return matching_pr_files
168
168
169
- def _is_warning_line_in_files (
169
+ def _is_warning_line_in_pr_files (
170
170
self , warning : StaticAnalysisWarning , matching_pr_files : list [PrFile ]
171
171
) -> bool :
172
172
# Encoded location format: "file:line:col"
@@ -189,7 +189,7 @@ def invoke(self, request: FilterWarningsRequest) -> FilterWarningsOutput:
189
189
for warning in request .warnings :
190
190
possible_pr_files = self ._get_possible_pr_files (warning , request .pr_files )
191
191
192
- if self ._is_warning_line_in_files (warning , possible_pr_files ):
192
+ if self ._is_warning_line_in_pr_files (warning , possible_pr_files ):
193
193
filtered_warnings .append (warning )
194
194
195
195
return FilterWarningsOutput (warnings = filtered_warnings )
0 commit comments