Skip to content

Commit fd8da5a

Browse files
committed
Fix logic for gathering fixed findings
1 parent 78424fd commit fd8da5a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/codemodder/file_context.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,22 @@ def add_unfixed_findings(
5050
]
5151
)
5252

53-
def get_findings_for_location(self, line_number: int):
53+
def get_findings_for_location(self, line_number: int) -> list[Finding]:
5454
return [
5555
result.finding
5656
for result in (self.results or [])
57-
if any(
58-
location.start.line <= line_number <= location.end.line
59-
for location in result.locations
60-
)
61-
or any(
62-
location.start.line <= line_number <= location.end.line
63-
for codeflow in result.codeflows
64-
for location in codeflow
57+
if result.finding is not None
58+
and (
59+
any(
60+
location.start.line <= line_number <= location.end.line
61+
for location in result.locations
62+
)
63+
or any(
64+
location.start.line <= line_number <= location.end.line
65+
for codeflow in result.codeflows
66+
for location in codeflow
67+
)
6568
)
66-
and result.finding is not None
6769
]
6870

6971
def match_findings(self, line_numbers):

0 commit comments

Comments
 (0)