Skip to content

Commit 5abe5c4

Browse files
committed
Add get_findings()
1 parent 04bfca3 commit 5abe5c4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sonar/pull_requests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ def api_params(self, op: Optional[str] = None) -> types.ApiParams:
106106
ops = {c.READ: {"project": self.concerned_object.key, "pullRequest": self.key}}
107107
return ops[op] if op and op in ops else ops[c.READ]
108108

109+
def get_findings(self, filters: Optional[types.ApiParams] = None) -> dict[str, object]:
110+
"""Returns a PR list of findings
111+
112+
:return: dict of Findings, with finding key as key
113+
:rtype: dict{key: Finding}
114+
"""
115+
if not filters:
116+
return self.concerned_object.get_findings(pr=self.key)
117+
return self.get_issues(filters) | self.get_hotspots(filters)
118+
109119

110120
def get_object(pull_request_key: str, project: object, data: types.ApiPayload = None) -> Optional[PullRequest]:
111121
"""Returns a PR object from a PR key and a project"""

0 commit comments

Comments
 (0)