Skip to content

Commit a93046c

Browse files
authored
Ruff: Add and fix ISC003 + merge ISC (#11706)
1 parent 76f5720 commit a93046c

16 files changed

+78
-51
lines changed

dojo/forms.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,10 @@ def __init__(self, *args, **kwargs):
328328
# if this product has findings being asynchronously updated, disable the sla config field
329329
if self.instance.async_updating:
330330
self.fields["sla_configuration"].disabled = True
331-
self.fields["sla_configuration"].widget.attrs["message"] = "Finding SLA expiration dates are currently being recalculated. " + \
332-
"This field cannot be changed until the calculation is complete."
331+
self.fields["sla_configuration"].widget.attrs["message"] = (
332+
"Finding SLA expiration dates are currently being recalculated. "
333+
"This field cannot be changed until the calculation is complete."
334+
)
333335

334336
class Meta:
335337
model = Product
@@ -954,8 +956,10 @@ class Meta:
954956
class EngForm(forms.ModelForm):
955957
name = forms.CharField(
956958
max_length=300, required=False,
957-
help_text="Add a descriptive name to identify this engagement. "
958-
+ "Without a name the target start date will be set.")
959+
help_text=(
960+
"Add a descriptive name to identify this engagement. "
961+
"Without a name the target start date will be set."
962+
))
959963
description = forms.CharField(widget=forms.Textarea(attrs={}),
960964
required=False, help_text="Description of the engagement and details regarding the engagement.")
961965
product = forms.ModelChoiceField(label="Product",
@@ -2640,8 +2644,10 @@ def __init__(self, *args, **kwargs):
26402644

26412645
# if this sla config has findings being asynchronously updated, disable the days by severity fields
26422646
if self.instance.async_updating:
2643-
msg = "Finding SLA expiration dates are currently being recalculated. " + \
2644-
"This field cannot be changed until the calculation is complete."
2647+
msg = (
2648+
"Finding SLA expiration dates are currently being recalculated. "
2649+
"This field cannot be changed until the calculation is complete."
2650+
)
26452651
self.fields["critical"].disabled = True
26462652
self.fields["enforce_critical"].disabled = True
26472653
self.fields["critical"].widget.attrs["message"] = msg

dojo/management/commands/jira_refactor_data_migration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
class Command(BaseCommand):
1212

13-
help = "Command to move data from some tables to other tables as part of https://github.com/DefectDojo/django-DefectDojo/pull/3200" + \
13+
help = (
14+
"Command to move data from some tables to other tables as part of https://github.com/DefectDojo/django-DefectDojo/pull/3200"
1415
"Should normally be handled by the migration in that PR, but if that causes errors, this command can help to get the data migrated anyway."
16+
)
1517

1618
def move_jira_creation_changed(self):
1719
logger.info("migrating finding.jira_creation and jira_change fields to JIRA_Issue model")

dojo/tools/gitleaks/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def get_finding_current(self, issue, test, dupes):
128128
if len(message.split("\n")) > 1:
129129
description += (
130130
"**Commit message:**"
131-
+ "\n```\n"
131+
"\n```\n"
132132
+ message.replace("```", "\\`\\`\\`")
133133
+ "\n```\n"
134134
)

dojo/tools/sslscan/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def get_findings(self, file, test):
4141
title = "heartbleed" + " | " + target.attrib["sslversion"]
4242
description = (
4343
"**heartbleed** :"
44-
+ "\n\n"
45-
+ "**sslversion** : "
44+
"\n\n"
45+
"**sslversion** : "
4646
+ target.attrib["sslversion"]
4747
+ "\n"
4848
)

dojo/tools/sslyze/parser_xml.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def get_findings(self, file, test):
7777
title = element.attrib["title"] + " | " + host
7878
description = (
7979
"**heartbleed** : Vulnerable"
80-
+ "\n\n"
81-
+ "**title** : "
80+
"\n\n"
81+
"**title** : "
8282
+ element.attrib["title"]
8383
)
8484
if element.tag == "openssl_ccs":
@@ -91,8 +91,8 @@ def get_findings(self, file, test):
9191
title = element.attrib["title"] + " | " + host
9292
description = (
9393
"**openssl_ccs** : Vulnerable"
94-
+ "\n\n"
95-
+ "**title** : "
94+
"\n\n"
95+
"**title** : "
9696
+ element.attrib["title"]
9797
)
9898
if element.tag == "reneg":
@@ -102,8 +102,8 @@ def get_findings(self, file, test):
102102
title = element.attrib["title"] + " | " + host
103103
description = (
104104
"**Session Renegotiation** : Vulnerable"
105-
+ "\n\n"
106-
+ "**title** : "
105+
"\n\n"
106+
"**title** : "
107107
+ element.attrib["title"]
108108
)
109109
if (

dojo/tools/trufflehog3/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def get_finding_current(self, json_data, test, dupes):
125125
if len(commit_message.split("\n")) > 1:
126126
description += (
127127
"**Commit message:** "
128-
+ "\n```\n"
128+
"\n```\n"
129129
+ commit_message.replace("```", "\\`\\`\\`")
130130
+ "\n```\n"
131131
)

dojo/user/validators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ def validate(self, password, user=None):
7777
return
7878

7979
def get_help_text(self):
80-
return gettext("The password must contain at least 1 special character, "
81-
+ """()[]{}|`~!@#$%^&*_-+=;:'",<>./?.""")
80+
return gettext(
81+
"The password must contain at least 1 special character, "
82+
"""()[]{}|`~!@#$%^&*_-+=;:'",<>./?.""",
83+
)
8284

8385

8486
class DojoCommonPasswordValidator(CommonPasswordValidator):

dojo/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ def do_false_positive_history(finding, *args, **kwargs):
101101

102102
existing_fp_findings = existing_findings.filter(false_p=True)
103103
deduplicationLogger.debug(
104-
"FALSE_POSITIVE_HISTORY: Found %i existing findings in the same product "
105-
+ "that were previously marked as false positive",
104+
(
105+
"FALSE_POSITIVE_HISTORY: Found %i existing findings in the same product "
106+
"that were previously marked as false positive"
107+
),
106108
len(existing_fp_findings),
107109
)
108110

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ select = [
5252
"EM",
5353
"EXE",
5454
"FA",
55-
"ISC001", "ISC002",
55+
"ISC",
5656
"ICN",
5757
"LOG",
5858
"G001", "G002", "G01", "G1", "G2",

tests/close_old_findings_dedupe_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ def test_delete_findings(self):
8080
driver.find_element(By.CSS_SELECTOR, "i.fa-solid.fa-trash").click()
8181
try:
8282
WebDriverWait(driver, 1).until(EC.alert_is_present(),
83-
"Timed out waiting for finding delete "
84-
+ "confirmation popup to appear.")
83+
"Timed out waiting for finding delete confirmation popup to appear.")
8584
driver.switch_to.alert.accept()
8685
except TimeoutException:
8786
self.fail("Confirmation dialogue not shown, cannot delete previous findings")

0 commit comments

Comments
 (0)