Skip to content

Commit 374c5b7

Browse files
author
Jino Tesauro
committed
Added line number field for SonarQube Scan and SonarQube Scan Detailed scantype
1 parent e3b46c1 commit 374c5b7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

dojo/tools/sonarqube/sonarqube_restapi_json.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_json_items(self, json_content, test, mode):
4949
static_finding=True,
5050
dynamic_finding=False,
5151
tags=["bug"],
52+
line=line,
5253
)
5354
elif issue.get("type") == "VULNERABILITY":
5455
key = issue.get("key")
@@ -58,6 +59,7 @@ def get_json_items(self, json_content, test, mode):
5859
flows = issue.get("flows", [])
5960
status = issue.get("status")
6061
message = issue.get("message")
62+
line = str(issue.get("line"))
6163
cwe = None
6264
if "Category: CWE-" in message:
6365
cwe_pattern = r"Category: CWE-\d{1,5}"
@@ -91,6 +93,7 @@ def get_json_items(self, json_content, test, mode):
9193
description += "**rule:** " + rule + "\n"
9294
description += "**component:** " + component + "\n"
9395
description += "**project:** " + project + "\n"
96+
description += "**line:** " + line + "\n"
9497
if flows != []:
9598
description += "**flows:** " + str(flows) + "\n"
9699
description += "**status:** " + status + "\n"
@@ -115,6 +118,7 @@ def get_json_items(self, json_content, test, mode):
115118
cvssv3_score=cvss,
116119
file_path=component,
117120
tags=["vulnerability"],
121+
line=line,
118122
)
119123
vulnids = []
120124
if "Reference: CVE" in message:
@@ -180,6 +184,7 @@ def get_json_items(self, json_content, test, mode):
180184
dynamic_finding=False,
181185
file_path=component,
182186
tags=["code_smell"],
187+
line=line,
183188
)
184189
items.append(item)
185190
if json_content.get("hotspots"):
@@ -223,6 +228,7 @@ def get_json_items(self, json_content, test, mode):
223228
dynamic_finding=False,
224229
file_path=component,
225230
tags=["hotspot"],
231+
line=line,
226232
)
227233
items.append(item)
228234
return items

0 commit comments

Comments
 (0)