Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 8 additions & 1 deletion src/codemodder/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
Loading