Skip to content

Commit b40ece1

Browse files
kiblikMaffooch
andauthored
Ruff: Add and fix PLW0108 (#11641)
Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
1 parent d4fd20c commit b40ece1

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

dojo/finding/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def reset_duplicate_before_delete(dupe):
450450

451451

452452
def reset_duplicates_before_delete(qs):
453-
mass_model_updater(Finding, qs, lambda f: reset_duplicate_before_delete(f), fields=["duplicate", "duplicate_finding"])
453+
mass_model_updater(Finding, qs, reset_duplicate_before_delete, fields=["duplicate", "duplicate_finding"])
454454

455455

456456
def set_new_original(finding, new_original):

dojo/management/commands/dedupe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def handle(self, *args, **options):
6767

6868
# only prefetch here for hash_code calculation
6969
finds = findings.prefetch_related("endpoints", "test__test_type")
70-
mass_model_updater(Finding, finds, lambda f: generate_hash_code(f), fields=["hash_code"], order="asc", log_prefix="hash_code computation ")
70+
mass_model_updater(Finding, finds, generate_hash_code, fields=["hash_code"], order="asc", log_prefix="hash_code computation ")
7171

7272
logger.info("######## Done Updating Hashcodes########")
7373

@@ -76,7 +76,7 @@ def handle(self, *args, **options):
7676
if get_system_setting("enable_deduplication"):
7777
logger.info("######## Start deduplicating (%s) ########", ("foreground" if dedupe_sync else "background"))
7878
if dedupe_sync:
79-
mass_model_updater(Finding, findings, lambda f: do_dedupe_finding(f), fields=None, order="desc", page_size=100, log_prefix="deduplicating ")
79+
mass_model_updater(Finding, findings, do_dedupe_finding, fields=None, order="desc", page_size=100, log_prefix="deduplicating ")
8080
else:
8181
# async tasks only need the id
8282
mass_model_updater(Finding, findings.only("id"), lambda f: do_dedupe_finding_task(f.id), fields=None, order="desc", log_prefix="deduplicating ")

dojo/management/commands/migrate_cve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def handle(self, *args, **options):
3838
mass_model_updater(
3939
Finding,
4040
findings,
41-
lambda f: create_vulnerability_id(f),
41+
create_vulnerability_id,
4242
fields=None,
4343
page_size=100,
4444
log_prefix="creating vulnerability ids: ",
@@ -49,7 +49,7 @@ def handle(self, *args, **options):
4949
mass_model_updater(
5050
Finding_Template,
5151
finding_templates,
52-
lambda f: create_vulnerability_id_template(f),
52+
create_vulnerability_id_template,
5353
fields=None,
5454
page_size=100,
5555
log_prefix="creating vulnerability ids: ",

dojo/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def update_product_access(backend, uid, user=None, social=None, *args, **kwargs)
176176

177177
def sanitize_username(username):
178178
allowed_chars_regex = re.compile(r"[\w@.+_-]")
179-
allowed_chars = filter(lambda char: allowed_chars_regex.match(char), list(username))
179+
allowed_chars = filter(allowed_chars_regex.match, list(username))
180180
return "".join(allowed_chars)
181181

182182

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ select = [
7676
"PLC01", "PLC0205", "PLC0208", "PLC0414", "PLC18", "PLC24", "PLC3",
7777
"PLE",
7878
"PLR01", "PLR0203", "PLR0206", "PLR0915", "PLR1716", "PLR172", "PLR1733", "PLR1736",
79-
"PLW0120", "PLW0127", "PLW0129", "PLW013", "PLW017", "PLW02", "PLW04", "PLW07", "PLW1", "PLW2", "PLW3",
79+
"PLW0108", "PLW0120", "PLW0127", "PLW0129", "PLW013", "PLW017", "PLW02", "PLW04", "PLW07", "PLW1", "PLW2", "PLW3",
8080
"TRY003", "TRY004", "TRY2", "TRY300", "TRY401",
8181
"FLY",
8282
"NPY",

0 commit comments

Comments
 (0)