diff --git a/pyproject.toml b/pyproject.toml index aa522c5b..df5431e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ "GitPython<4", "isort>=5.12,<6.1", "libcst>=1.7,<1.8", - "packaging>=25,<25.1", + "packaging>=24.2,<25.1", # do not update pydantic due to inconsistent test failures "pydantic~=2.10.6", "pylint>=3.3,<3.4", diff --git a/src/codemodder/result.py b/src/codemodder/result.py index ecc5a03e..c221fa84 100644 --- a/src/codemodder/result.py +++ b/src/codemodder/result.py @@ -84,7 +84,7 @@ class Result(ABCDataclass): locations: Sequence[Location] codeflows: Sequence[Sequence[Location]] = field(default_factory=tuple) related_locations: Sequence[LocationWithMessage] = field(default_factory=tuple) - finding: Finding | None = None + finding: Finding def match_location(self, pos: CodeRange, node: cst.CSTNode) -> bool: del node @@ -103,6 +103,13 @@ def match_location(self, pos: CodeRange, node: cst.CSTNode) -> bool: def __hash__(self): return hash(self.rule_id) + def get_locations(self) -> Sequence[Sequence[Location]]: + return self.codeflows or ( + [self.locations] + if self.locations + else [[loc.location for loc in self.related_locations]] + ) + @dataclass(frozen=True, kw_only=True) class SASTResult(Result):