Skip to content

Commit 719fae3

Browse files
authored
Ruff: Add and autofix PLR1711 (#13003)
1 parent 771db7c commit 719fae3

7 files changed

Lines changed: 1 addition & 24 deletions

File tree

dojo/importers/base_importer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ def update_test_meta(self):
286286
if not self.commit_hash.isspace():
287287
self.test.commit_hash = self.commit_hash
288288

289-
return
290-
291289
def update_timestamps(self):
292290
"""
293291
Update the target end dates for tests as imports are occurring:

dojo/importers/endpoint_manager.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def add_endpoints_to_unsaved_finding(
5353
endpoint=ep,
5454
defaults={"date": finding.date})
5555
logger.debug(f"IMPORT_SCAN: {len(endpoints)} endpoints imported")
56-
return
5756

5857
@dojo_async_task
5958
@app.task()
@@ -73,7 +72,6 @@ def mitigate_endpoint_status(
7372
endpoint_status.mitigated_by = user
7473
endpoint_status.mitigated = True
7574
endpoint_status.save()
76-
return
7775

7876
@dojo_async_task
7977
@app.task()
@@ -92,7 +90,6 @@ def reactivate_endpoint_status(
9290
endpoint_status.mitigated = False
9391
endpoint_status.last_modified = timezone.now()
9492
endpoint_status.save()
95-
return
9693

9794
def chunk_endpoints_and_disperse(
9895
self,
@@ -101,7 +98,6 @@ def chunk_endpoints_and_disperse(
10198
**kwargs: dict,
10299
) -> None:
103100
self.add_endpoints_to_unsaved_finding(finding, endpoints, sync=True)
104-
return
105101

106102
def clean_unsaved_endpoints(
107103
self,
@@ -116,15 +112,13 @@ def clean_unsaved_endpoints(
116112
endpoint.clean()
117113
except ValidationError as e:
118114
logger.warning(f"DefectDojo is storing broken endpoint because cleaning wasn't successful: {e}")
119-
return
120115

121116
def chunk_endpoints_and_reactivate(
122117
self,
123118
endpoint_status_list: list[Endpoint_Status],
124119
**kwargs: dict,
125120
) -> None:
126121
self.reactivate_endpoint_status(endpoint_status_list, sync=True)
127-
return
128122

129123
def chunk_endpoints_and_mitigate(
130124
self,
@@ -133,7 +127,6 @@ def chunk_endpoints_and_mitigate(
133127
**kwargs: dict,
134128
) -> None:
135129
self.mitigate_endpoint_status(endpoint_status_list, user, sync=True)
136-
return
137130

138131
def update_endpoint_status(
139132
self,
@@ -166,4 +159,3 @@ def update_endpoint_status(
166159
)
167160
self.chunk_endpoints_and_reactivate(endpoint_status_to_reactivate)
168161
self.chunk_endpoints_and_mitigate(endpoint_status_to_mitigate, user)
169-
return

dojo/risk_acceptance/helper.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ def remove_finding_from_risk_acceptance(user: Dojo_User, risk_acceptance: Risk_A
136136
author=user,
137137
))
138138

139-
return
140-
141139

142140
def add_findings_to_risk_acceptance(user: Dojo_User, risk_acceptance: Risk_Acceptance, findings: list[Finding]) -> None:
143141
for finding in findings:
@@ -167,8 +165,6 @@ def add_findings_to_risk_acceptance(user: Dojo_User, risk_acceptance: Risk_Accep
167165
# best effort jira integration, no status changes
168166
post_jira_comments(risk_acceptance, findings, accepted_message_creator)
169167

170-
return
171-
172168

173169
@app.task
174170
def expiration_handler(*args, **kwargs):

dojo/system_settings/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ def get_celery_status(
115115
context["celery_msg"] = "Celery needs to have the setting CELERY_RESULT_BACKEND = 'db+sqlite:///dojo.celeryresults.sqlite' set in settings.py."
116116
context["celery_status"] = "Unknown"
117117

118-
return
119-
120118
def get_template(self) -> str:
121119
return "dojo/system_settings.html"
122120

dojo/tools/cyclonedx/json_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ def _flatten_components(self, components, flatted_components):
141141
# tools don't provide it
142142
if "bom-ref" in component:
143143
flatted_components[component["bom-ref"]] = component
144-
return

dojo/user/validators.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def validate(self, password, user=None):
1313
raise ValidationError(
1414
self.get_help_text(),
1515
code="password_too_short")
16-
return
1716

1817
def get_help_text(self):
1918
return gettext("Password must be at least %s characters long.") % get_system_setting("minimum_password_length")
@@ -25,7 +24,6 @@ def validate(self, password, user=None):
2524
raise ValidationError(
2625
self.get_help_text(),
2726
code="password_too_short")
28-
return
2927

3028
def get_help_text(self):
3129
return gettext("Password must be less than %s characters long.") % get_system_setting("maximum_password_length")
@@ -37,7 +35,6 @@ def validate(self, password, user=None):
3735
raise ValidationError(
3836
self.get_help_text(),
3937
code="password_no_number")
40-
return
4138

4239
def get_help_text(self):
4340
return gettext("Password must contain at least 1 digit, 0-9.")
@@ -49,7 +46,6 @@ def validate(self, password, user=None):
4946
raise ValidationError(
5047
self.get_help_text(),
5148
code="password_no_upper")
52-
return
5349

5450
def get_help_text(self):
5551
return gettext("Password must contain at least 1 uppercase letter, A-Z.")
@@ -61,7 +57,6 @@ def validate(self, password, user=None):
6157
raise ValidationError(
6258
self.get_help_text(),
6359
code="password_no_lower")
64-
return
6560

6661
def get_help_text(self):
6762
return gettext("Password must contain at least 1 lowercase letter, a-z.")
@@ -74,7 +69,6 @@ def validate(self, password, user=None):
7469
raise ValidationError(
7570
self.get_help_text(),
7671
code="password_no_symbol")
77-
return
7872

7973
def get_help_text(self):
8074
return gettext(

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ select = [
8484
"PGH",
8585
"PLC01", "PLC02", "PLC0414", "PLC18", "PLC24", "PLC28", "PLC3",
8686
"PLE",
87-
"PLR01", "PLR02", "PLR04", "PLR0915", "PLR1716", "PLR172", "PLR173", "PLR2044", "PLR5", "PLR6104", "PLR6201",
87+
"PLR01", "PLR02", "PLR04", "PLR0915", "PLR1711", "PLR1716", "PLR172", "PLR173", "PLR2044", "PLR5", "PLR6104", "PLR6201", #"PLR",
8888
"PLW01", "PLW02", "PLW04", "PLW0602", "PLW0604", "PLW07", "PLW1", "PLW2", "PLW3",
8989
"UP",
9090
"FURB",

0 commit comments

Comments
 (0)