Skip to content

Commit 18644d6

Browse files
Ruff: Add PLC0206 (#12426)
* Ruff: Add PLC0206 * 💄 * update * Update dojo/utils.py Co-authored-by: kiblik <5609770+kiblik@users.noreply.github.com> * update * revert * update * Update dojo/tools/factory.py Co-authored-by: kiblik <5609770+kiblik@users.noreply.github.com> --------- Co-authored-by: kiblik <5609770+kiblik@users.noreply.github.com>
1 parent 66b30da commit 18644d6

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

dojo/tools/checkmarx/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ def _get_findings_xml(self, filename, test):
176176
dupes[key].vuln_id_from_tool = ",".join(
177177
vuln_ids_from_tool[key],
178178
)[:500]
179-
for lang in language_list:
179+
for lang, file in language_list.items():
180180
add_language(
181-
test.engagement.product, lang, files=language_list[lang],
181+
test.engagement.product, lang, files=file,
182182
)
183183

184184
return list(dupes.values())

dojo/tools/mobsf_scorecard/parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ def get_findings(self, filename, test):
7878

7979
dd_findings = {}
8080

81-
for finding_severity in finding_severities:
82-
if finding_severity in data.get("appsec", {}):
83-
for mobsf_finding in data["appsec"][finding_severity]:
81+
for mobsf_severity, defectdojo_severity in finding_severities.items():
82+
if mobsf_severity in data.get("appsec", {}):
83+
for mobsf_finding in data["appsec"][mobsf_severity]:
8484

8585
section = str(mobsf_finding.get("section", ""))
8686
title = str(mobsf_finding.get("title", ""))
8787
description = str(mobsf_finding.get("description", ""))
8888

89-
unique_key = f"{finding_severity}-{section}-{title}-{description}"
89+
unique_key = f"{mobsf_severity}-{section}-{title}-{description}"
9090

9191
finding = Finding(
9292
title=title,
9393
cwe=919, # Weaknesses in Mobile Applications
9494
test=test,
9595
description=f"**Category:** {section}\n\n{description}",
96-
severity=finding_severities[finding_severity],
96+
severity=defectdojo_severity,
9797
references=None,
9898
date=find_date,
9999
static_finding=True,

dojo/tools/nmap/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ def manage_vulner_script(
172172
description = "### Vulnerability\n\n"
173173
description += "**ID**: `" + str(vuln_id) + "`\n"
174174
description += "**CPE**: " + str(component_cpe) + "\n"
175-
for attribute in vuln_attributes:
175+
for attribute, value in vuln_attributes.items():
176176
description += (
177177
"**"
178178
+ attribute
179179
+ "**: `"
180-
+ vuln_attributes[attribute]
180+
+ value
181181
+ "`\n"
182182
)
183183
severity = self.convert_cvss_score(vuln_attributes["cvss"])

dojo/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,17 +1904,17 @@ def _notification_title_for_finding(finding, kind, sla_age):
19041904
return title
19051905

19061906
def _create_notifications():
1907-
for pt in combined_notifications:
1908-
for p in combined_notifications[pt]:
1909-
for kind in combined_notifications[pt][p]:
1907+
for prodtype, comb_notif_prodtype in combined_notifications.items():
1908+
for prod, comb_notif_prod in comb_notif_prodtype.items():
1909+
for kind, comb_notif_kind in comb_notif_prod.items():
19101910
# creating notifications on per-finding basis
19111911

19121912
# we need this list for combined notification feature as we
19131913
# can not supply references to local objects as
19141914
# create_notification() arguments
19151915
findings_list = []
19161916

1917-
for n in combined_notifications[pt][p][kind]:
1917+
for n in comb_notif_kind:
19181918
title = _notification_title_for_finding(n.finding, kind, n.finding.sla_days_remaining())
19191919

19201920
create_notification(
@@ -1931,8 +1931,8 @@ def _create_notifications():
19311931
findings_list.append(n.finding)
19321932

19331933
# producing a "combined" SLA breach notification
1934-
title_combined = f"SLA alert ({kind}): product type '{pt}', product '{p}'"
1935-
product = combined_notifications[pt][p][kind][0].finding.test.engagement.product
1934+
title_combined = f"SLA alert ({kind}): product type '{prodtype}', product '{prod}'"
1935+
product = comb_notif_kind[0].finding.test.engagement.product
19361936
create_notification(
19371937
event="sla_breach_combined",
19381938
title=title_combined,

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ select = [
7474
"FIX",
7575
"PD",
7676
"PGH",
77-
"PLC01", "PLC0205", "PLC0208", "PLC0414", "PLC18", "PLC24", "PLC28", "PLC3",
77+
"PLC01", "PLC02", "PLC0414", "PLC18", "PLC24", "PLC28", "PLC3",
7878
"PLE",
7979
"PLR01", "PLR02", "PLR04", "PLR0915", "PLR1716", "PLR172", "PLR173", "PLR2044", "PLR5", "PLR6104", "PLR6201",
8080
"PLW01", "PLW02", "PLW04", "PLW0602", "PLW0604", "PLW07", "PLW1", "PLW2", "PLW3",

0 commit comments

Comments
 (0)