File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 33
44from codemodder .codetf import Change , ChangeSet , Finding , UnfixedFinding
55from codemodder .dependency import Dependency
6+ from codemodder .logging import logger
67from codemodder .result import Result
78from codemodder .utils .timer import Timer
89
@@ -60,6 +61,32 @@ def get_findings_for_location(self, line_number: int):
6061 and result .finding is not None
6162 ]
6263
64+ def match_findings (self , line_numbers ):
65+ """
66+ Find the first finding that applies to any of the changed lines
67+ NOTE: this is necessarily heuristic and may not always be correct
68+ """
69+ findings = next (
70+ (
71+ findings
72+ for line in line_numbers
73+ if (findings := self .get_findings_for_location (line ))
74+ ),
75+ None ,
76+ )
77+
78+ if (
79+ findings is None
80+ and line_numbers
81+ and any (result .finding for result in self .results or [])
82+ ):
83+ logger .debug (
84+ "Did not match line_numbers %s with one of these results: '%s'" ,
85+ line_numbers ,
86+ self .results ,
87+ )
88+ return findings
89+
6390 def get_all_findings (self ):
6491 return [
6592 result .finding
You can’t perform that action at this time.
0 commit comments