Skip to content

Commit 65ec294

Browse files
style: fix ruff ternary and spacing issues
1 parent eeeac1a commit 65ec294

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

dojo/tools/qualys/parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ def parse_finding(host, tree):
359359
endpoint_port = int(port)
360360
# manage endpoint/location
361361
if settings.V3_FEATURE_LOCATIONS:
362-
host_val = issue_row["fqdn"] if issue_row["fqdn"] else issue_row["ip_address"]
363-
location = URL(host = host_val,port = endpoint_port)
362+
host_val = issue_row["fqdn"] or issue_row["ip_address"]
363+
location = URL(host=host_val, port=endpoint_port)
364364
finding.unsaved_locations = [location]
365365
else:
366366
# TODO: Delete this after the move to Locations
367-
host_val = issue_row["fqdn"] if issue_row["fqdn"] else issue_row["ip_address"]
368-
location = Endpoint(host=host_val,port = endpoint_port)
367+
host_val = issue_row["fqdn"] or issue_row["ip_address"]
368+
location = Endpoint(host=host_val, port=endpoint_port)
369369
finding.unsaved_endpoints = [location]
370370
finding.unsaved_vulnerability_ids = temp.get("cve_list", [])
371371
ret_rows.append(finding)

unittests/tools/test_qualys_parser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ def test_parse_file_with_no_vuln_has_no_findings(self):
1717
self.parse_file_with_no_vuln_has_no_findings()
1818

1919
def test_parse_file_with_multiple_ports_for_same_qid(self):
20-
with (get_unit_tests_scans_path("qualys") / "test_qualys.xml").open(encoding = "utf-8") as testfile:
20+
with (get_unit_tests_scans_path("qualys") / "test_qualys.xml").open(encoding="utf-8") as testfile:
2121
parser = QualysParser()
22-
findings = parser.get_findings(testfile,Test())
22+
findings = parser.get_findings(testfile, Test())
2323

24-
self.assertEqual(len(findings),2,"Should have 2 findings for different ports")
24+
self.assertEqual(len(findings), 2, "Should have 2 findings for different ports")
2525
ports = [self.get_unsaved_locations(f)[0].port for f in findings]
26-
self.assertIn(80,ports)
27-
self.assertIn(443,ports)
26+
self.assertIn(80, ports)
27+
self.assertIn(443, ports)
2828

29-
self.assertEqual(findings[0].title,findings[1].title)
29+
self.assertEqual(findings[0].title, findings[1].title)
3030
self.assertNotEqual(
3131
self.get_unsaved_locations(findings[0])[0].port,
32-
self.get_unsaved_locations(findings[1])[0].port
32+
self.get_unsaved_locations(findings[1])[0].port,
3333
)
3434

3535
def parse_file_with_no_vuln_has_no_findings(self):

0 commit comments

Comments
 (0)