Skip to content

Commit 7536a63

Browse files
committed
Ruff: fix Q003
1 parent 660d54e commit 7536a63

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

dojo/filters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ class FindingFilterHelper(FilterSet):
16111611
"The range of EPSS score percentages to filter on; the left input is a lower bound, "
16121612
"the right is an upper bound. Leaving one empty will skip that bound (e.g., leaving "
16131613
"the lower bound input empty will filter only on the upper bound -- filtering on "
1614-
"\"less than or equal\")."
1614+
'"less than or equal").'
16151615
))
16161616
epss_percentile = PercentageFilter(field_name="epss_percentile", label="EPSS percentile")
16171617
epss_percentile_range = PercentageRangeFilter(
@@ -1620,7 +1620,7 @@ class FindingFilterHelper(FilterSet):
16201620
help_text=(
16211621
"The range of EPSS percentiles to filter on; the left input is a lower bound, the right "
16221622
"is an upper bound. Leaving one empty will skip that bound (e.g., leaving the lower bound "
1623-
"input empty will filter only on the upper bound -- filtering on \"less than or equal\")."
1623+
'input empty will filter only on the upper bound -- filtering on "less than or equal").'
16241624
))
16251625

16261626
o = OrderingFilter(

dojo/finding/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ def request_finding_review(request, fid):
17091709
finding=finding,
17101710
reviewers=reviewers,
17111711
recipients=reviewers_usernames,
1712-
description=f"User {user.get_full_name()} has requested that user(s) {reviewers_string} review the finding \"{finding.title}\" for accuracy:\n\n{new_note}",
1712+
description=f'User {user.get_full_name()} has requested that user(s) {reviewers_string} review the finding "{finding.title}" for accuracy:\n\n{new_note}',
17131713
icon="check",
17141714
url=reverse("view_finding", args=(finding.id,)),
17151715
)

dojo/jira_link/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def post(self, request, tid=None):
542542
create_notification(
543543
event='jira_config_deleted',
544544
title=_('Deletion of JIRA: %s') % jira_instance.configuration_name,
545-
description=f"JIRA \"{jira_instance.configuration_name}\" was deleted by {request.user}",
545+
description=f'JIRA "{jira_instance.configuration_name}" was deleted by {request.user}',
546546
url=request.build_absolute_uri(reverse('jira')))
547547
return HttpResponseRedirect(reverse('jira'))
548548
except Exception as e:

dojo/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3910,7 +3910,7 @@ class JIRA_Project(models.Model):
39103910
engagement = models.OneToOneField(Engagement, on_delete=models.CASCADE, null=True, blank=True)
39113911
component = models.CharField(max_length=200, blank=True)
39123912
custom_fields = models.JSONField(max_length=200, blank=True, null=True,
3913-
help_text=_("JIRA custom field JSON mapping of Id to value, e.g. {\"customfield_10122\": [{\"name\": \"8.0.1\"}]}"))
3913+
help_text=_('JIRA custom field JSON mapping of Id to value, e.g. {"customfield_10122": [{"name": "8.0.1"}]}'))
39143914
default_assignee = models.CharField(max_length=200, blank=True, null=True,
39153915
help_text=_("JIRA default assignee (name). If left blank then it defaults to whatever is configured in JIRA."))
39163916
jira_labels = models.CharField(max_length=200, blank=True, null=True,

dojo/sla_config/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def edit_sla_config(request, slaid):
4242
if request.method == 'POST' and request.POST.get('delete'):
4343
if sla_config.id != 1:
4444
if Product.objects.filter(sla_configuration=sla_config).count():
45-
msg = f"The \"{sla_config}\" SLA configuration could not be deleted, as it is currently in use by one or more products."
45+
msg = f'The "{sla_config}" SLA configuration could not be deleted, as it is currently in use by one or more products.'
4646
messages.add_message(request,
4747
messages.ERROR,
4848
msg,

dojo/templatetags/display_tags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def notspecified(text):
378378
if text:
379379
return text
380380
else:
381-
return mark_safe("<em class=\"text-muted\">Not Specified</em>")
381+
return mark_safe('<em class="text-muted">Not Specified</em>')
382382

383383

384384
@register.tag

dojo/tools/api_sonarqube/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def get_issue(self, issue_key):
265265
if issue["key"] == issue_key:
266266
return issue
267267
msg = (
268-
f"Expected Issue \"{issue_key}\", but it returned"
268+
f'Expected Issue "{issue_key}", but it returned'
269269
f"{[x.get('key') for x in response.json().get('issues')]}. "
270270
"Full response: "
271271
f"{response.json()}"

unittests/tools/test_mozilla_observatory_parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_parse_file_cli_juicy(self):
106106
elif "subresource-integrity" == finding.vuln_id_from_tool:
107107
with self.subTest(vuln_id_from_tool=finding.vuln_id_from_tool):
108108
self.assertTrue(finding.active)
109-
self.assertEqual("Subresource Integrity (SRI) not implemented, and external scripts are loaded over HTTP or use protocol-relative URLs via src=\"//...\"", finding.title)
109+
self.assertEqual('Subresource Integrity (SRI) not implemented, and external scripts are loaded over HTTP or use protocol-relative URLs via src="//..."', finding.title)
110110
self.assertEqual("High", finding.severity)
111111
self.assertIn("Subresource Integrity (SRI) not implemented", finding.description)
112112
elif "redirection" == finding.vuln_id_from_tool:
@@ -159,7 +159,7 @@ def test_parse_file_cli_nmap_scanme(self):
159159
elif "subresource-integrity" == finding.vuln_id_from_tool:
160160
with self.subTest(vuln_id_from_tool=finding.vuln_id_from_tool):
161161
self.assertTrue(finding.active)
162-
self.assertEqual("Subresource Integrity (SRI) not implemented, and external scripts are loaded over HTTP or use protocol-relative URLs via src=\"//...\"", finding.title)
162+
self.assertEqual('Subresource Integrity (SRI) not implemented, and external scripts are loaded over HTTP or use protocol-relative URLs via src="//..."', finding.title)
163163
self.assertEqual("High", finding.severity)
164164
self.assertIn("Subresource Integrity (SRI) not implemented", finding.description)
165165
elif "redirection" == finding.vuln_id_from_tool:

unittests/tools/test_nexpose_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_nexpose_parser_has_many_finding(self):
6565

6666
# vuln 5
6767
finding = findings[5]
68-
self.assertEqual("Default SSH password: root password \"root\"", finding.title)
68+
self.assertEqual('Default SSH password: root password "root"', finding.title)
6969
self.assertEqual(1, len(finding.unsaved_endpoints))
7070

7171
# vuln 5 - endpoint

unittests/tools/test_nikto_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_parse_file_xml_another(self):
166166
self.assertIsNone(endpoint.path)
167167
with self.subTest(i=5):
168168
finding = findings[5]
169-
self.assertEqual("The Content-Encoding header is set to \"deflate\" this may mean that the server is vulnerable to the BREACH attack.", finding.title)
169+
self.assertEqual('The Content-Encoding header is set to "deflate" this may mean that the server is vulnerable to the BREACH attack.', finding.title)
170170
self.assertEqual("999966", finding.vuln_id_from_tool)
171171
self.assertEqual(1, finding.nb_occurences)
172172
self.assertEqual("Info", finding.severity)

unittests/tools/test_qualys_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def test_parse_file_with_cvss_values_and_scores(self):
154154
finding_cvssv3_score = finding
155155
if finding.unsaved_endpoints[0].host == "demo13.s02.sjc01.qualys.com" and finding.title == "QID-370876 | AMD Processors Multiple Security Vulnerabilities (RYZENFALL/MASTERKEY/CHIMERA-FW/FALLOUT)":
156156
finding_no_cvssv3_at_detection = finding
157-
if finding.unsaved_endpoints[0].host == "demo14.s02.sjc01.qualys.com" and finding.title == "QID-121695 | NTP \"monlist\" Feature Denial of Service Vulnerability":
157+
if finding.unsaved_endpoints[0].host == "demo14.s02.sjc01.qualys.com" and finding.title == 'QID-121695 | NTP "monlist" Feature Denial of Service Vulnerability':
158158
finding_no_cvssv3 = finding
159159
# The CVSS Vector is not used from the Knowledgebase
160160
self.assertEqual(

unittests/tools/test_semgrep_parser.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def test_parse_one_finding(self):
2222
self.assertEqual("src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02194.java", finding.file_path)
2323
self.assertEqual(64, finding.line)
2424
self.assertEqual(696, finding.cwe)
25-
self.assertEqual("javax crypto Cipher.getInstance(\"AES/GCM/NoPadding\");", finding.mitigation)
25+
self.assertEqual('javax crypto Cipher.getInstance("AES/GCM/NoPadding");', finding.mitigation)
2626
self.assertEqual("java.lang.security.audit.cbc-padding-oracle.cbc-padding-oracle", finding.vuln_id_from_tool)
27-
self.assertIn("javax.crypto.Cipher c = javax.crypto.Cipher.getInstance(\"DES/CBC/PKCS5Padding\");", finding.description)
27+
self.assertIn('javax.crypto.Cipher c = javax.crypto.Cipher.getInstance("DES/CBC/PKCS5Padding");', finding.description)
2828
self.assertIn("Using CBC with PKCS5Padding is susceptible to padding orcale attacks", finding.description)
2929

3030
def test_parse_many_finding(self):
@@ -37,14 +37,14 @@ def test_parse_many_finding(self):
3737
self.assertEqual("src/main/java/org/owasp/benchmark/testcode/BenchmarkTest02194.java", finding.file_path)
3838
self.assertEqual(64, finding.line)
3939
self.assertEqual(696, finding.cwe)
40-
self.assertEqual("javax crypto Cipher.getInstance(\"AES/GCM/NoPadding\");", finding.mitigation)
40+
self.assertEqual('javax crypto Cipher.getInstance("AES/GCM/NoPadding");', finding.mitigation)
4141
self.assertEqual("java.lang.security.audit.cbc-padding-oracle.cbc-padding-oracle", finding.vuln_id_from_tool)
4242
finding = findings[2]
4343
self.assertEqual("Info", finding.severity)
4444
self.assertEqual("src/main/java/org/owasp/benchmark/testcode/BenchmarkTest01150.java", finding.file_path)
4545
self.assertEqual(66, finding.line)
4646
self.assertEqual(696, finding.cwe)
47-
self.assertEqual("javax crypto Cipher.getInstance(\"AES/GCM/NoPadding\");", finding.mitigation)
47+
self.assertEqual('javax crypto Cipher.getInstance("AES/GCM/NoPadding");', finding.mitigation)
4848
self.assertEqual("java.lang.security.audit.cbc-padding-oracle.cbc-padding-oracle", finding.vuln_id_from_tool)
4949

5050
def test_parse_repeated_finding(self):
@@ -58,7 +58,7 @@ def test_parse_repeated_finding(self):
5858
self.assertEqual(66, finding.line)
5959
self.assertEqual("java.lang.security.audit.cbc-padding-oracle.cbc-padding-oracle", finding.vuln_id_from_tool)
6060
self.assertEqual(696, finding.cwe)
61-
self.assertEqual("javax crypto Cipher.getInstance(\"AES/GCM/NoPadding\");", finding.mitigation)
61+
self.assertEqual('javax crypto Cipher.getInstance("AES/GCM/NoPadding");', finding.mitigation)
6262
self.assertEqual(2, finding.nb_occurences)
6363

6464
def test_parse_many_vulns(self):

0 commit comments

Comments
 (0)