Skip to content

Commit c0df538

Browse files
cleanup
1 parent c914d11 commit c0df538

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/seer/automation/codegen/relevant_warnings_component.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def _get_possible_pr_files(
128128
path = Path(filename)
129129

130130
# 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:])
133133
if ".." in path.parts:
134134
raise ValueError(
135135
f"Found `..` in the middle of path. Encoded location: {warning.encoded_location}"
@@ -142,18 +142,18 @@ def _get_possible_pr_files(
142142
}
143143

144144
# 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] = {}
146146
for pr_file in pr_files:
147147
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
149149
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
151151

152152
# 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])
157157

158158
if matching_pr_files:
159159
self.logger.debug(
@@ -166,7 +166,7 @@ def _get_possible_pr_files(
166166

167167
return matching_pr_files
168168

169-
def _is_warning_line_in_files(
169+
def _is_warning_line_in_pr_files(
170170
self, warning: StaticAnalysisWarning, matching_pr_files: list[PrFile]
171171
) -> bool:
172172
# Encoded location format: "file:line:col"
@@ -189,7 +189,7 @@ def invoke(self, request: FilterWarningsRequest) -> FilterWarningsOutput:
189189
for warning in request.warnings:
190190
possible_pr_files = self._get_possible_pr_files(warning, request.pr_files)
191191

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):
193193
filtered_warnings.append(warning)
194194

195195
return FilterWarningsOutput(warnings=filtered_warnings)

0 commit comments

Comments
 (0)