Skip to content

Commit e296b78

Browse files
⬆️ Bump ruff to 0.13.2 (#13267)
1 parent 649f866 commit e296b78

10 files changed

Lines changed: 17 additions & 14 deletions

File tree

dojo/importers/endpoint_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def reactivate_endpoint_status(
8484
for endpoint_status in endpoint_status_list:
8585
# Only reactivate endpoints that are actually mitigated
8686
if endpoint_status.mitigated:
87-
logger.debug("Re-import: reactivating endpoint %s that is present in this scan", str(endpoint_status.endpoint))
87+
logger.debug("Re-import: reactivating endpoint %s that is present in this scan", endpoint_status.endpoint)
8888
endpoint_status.mitigated_by = None
8989
endpoint_status.mitigated_time = None
9090
endpoint_status.mitigated = False

dojo/jira_link/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ def process_jira_project_form(request, instance=None, target=None, product=None,
16491649
# jform = JIRAProjectForm(request.POST, instance=instance if instance else JIRA_Project(), product=product)
16501650
jform = JIRAProjectForm(request.POST, instance=instance, target=target, product=product, engagement=engagement)
16511651
# logging has_changed because it sometimes doesn't do what we expect
1652-
logger.debug("jform has changed: %s", str(jform.has_changed()))
1652+
logger.debug("jform has changed: %s", jform.has_changed())
16531653

16541654
if jform.has_changed(): # if no data was changed, no need to do anything!
16551655
logger.debug("jform changed_data: %s", jform.changed_data)

dojo/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __call__(self, request):
6262
return HttpResponseRedirect(fullURL)
6363

6464
if request.user.is_authenticated:
65-
logger.debug("Authenticated user: %s", str(request.user))
65+
logger.debug("Authenticated user: %s", request.user)
6666
with suppress(ModuleNotFoundError): # to avoid unittests to fail
6767
uwsgi = __import__("uwsgi", globals(), locals(), ["set_logvar"], 0)
6868
# this populates dd_user log var, so can appear in the uwsgi logs

dojo/pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ def assign_user_to_groups(user, group_names, social_provider):
114114
for group_name in group_names:
115115
group, created_group = Dojo_Group.objects.get_or_create(name=group_name, social_provider=social_provider)
116116
if created_group:
117-
logger.debug("Group %s for social provider %s was created", str(group), social_provider)
117+
logger.debug("Group %s for social provider %s was created", group, social_provider)
118118
_group_member, is_member_created = Dojo_Group_Member.objects.get_or_create(group=group, user=user, defaults={
119119
"role": Role.objects.get(id=Roles.Maintainer)})
120120
if is_member_created:
121-
logger.debug("User %s become member of group %s (social provider: %s)", user, str(group), social_provider)
121+
logger.debug("User %s become member of group %s (social provider: %s)", user, group, social_provider)
122122

123123

124124
def cleanup_old_groups_for_user(user, group_names):
125125
for group_member in Dojo_Group_Member.objects.select_related("group").filter(user=user):
126126
group = group_member.group
127127
if str(group) not in group_names:
128-
logger.debug("Deleting membership of user %s from %s group %s", user, group.social_provider, str(group))
128+
logger.debug("Deleting membership of user %s from %s group %s", user, group.social_provider, group)
129129
group_member.delete()
130130

131131

dojo/tools/ms_defender/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_findings(self, file, test):
3131
vulnerabilitydata = vulnerabilityfile["value"]
3232
findings.extend(self.process_json(vulnerability) for vulnerability in vulnerabilitydata)
3333
except (json.JSONDecodeError, KeyError) as e:
34-
logger.warning("Error parsing JSON file %s: %s", file.name, str(e))
34+
logger.warning("Error parsing JSON file %s: %s", file.name, e)
3535
return []
3636
elif str(file.name).endswith(".zip"):
3737
if str(file.__class__) == "<class '_io.TextIOWrapper'>":
@@ -71,7 +71,7 @@ def get_findings(self, file, test):
7171
for data in output:
7272
vulnerabilities.append(data)
7373
except (json.JSONDecodeError, KeyError, UnicodeDecodeError) as e:
74-
logger.warning("Error parsing vulnerability file %s: %s", vulnerabilityfile, str(e))
74+
logger.warning("Error parsing vulnerability file %s: %s", vulnerabilityfile, e)
7575
continue
7676

7777
for machinefile in machinefiles:
@@ -91,7 +91,7 @@ def get_findings(self, file, test):
9191
for data in output:
9292
machines[data.get("id")] = data
9393
except (json.JSONDecodeError, KeyError, UnicodeDecodeError) as e:
94-
logger.warning("Error parsing machine file %s: %s", machinefile, str(e))
94+
logger.warning("Error parsing machine file %s: %s", machinefile, e)
9595
continue
9696
for vulnerability in vulnerabilities:
9797
try:

dojo/tools/nuclei/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_findings(self, filename, test):
4141
data.extend(json.loads(line) for line in file if line)
4242
dupes = {}
4343
for item in data:
44-
logger.debug("Item %s.", str(item))
44+
logger.debug("Item %s.", item)
4545
template_id = item.get("templateID", item.get("template-id", ""))
4646
info = item.get("info")
4747
name = info.get("name")
@@ -148,7 +148,7 @@ def get_findings(self, filename, test):
148148
).hexdigest()
149149

150150
if dupe_key in dupes:
151-
logger.debug("dupe_key %s exists.", str(dupe_key))
151+
logger.debug("dupe_key %s exists.", dupe_key)
152152
finding = dupes[dupe_key]
153153
if endpoint not in finding.unsaved_endpoints:
154154
finding.unsaved_endpoints.append(endpoint)

requirements-lint.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruff==0.13.1
1+
ruff==0.13.2

ruff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ preview = true
113113
"S105", # hardcoded passwords in tests are fine
114114
"S108", # tmp paths mentioned in tests are fine
115115
]
116+
"dojo/filters.py" = [
117+
"A003", # ruff upgrade to 0.13.3
118+
]
116119

117120
[lint.flake8-boolean-trap]
118121
extend-allowed-calls = ["dojo.utils.get_system_setting"]

unittests/test_deduplication_logic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ def assert_finding(self, finding, not_pk=None, *, duplicate=False, duplicate_fin
12671267

12681268
def set_dedupe_inside_engagement(self, deduplication_on_engagement):
12691269
for eng in Engagement.objects.all():
1270-
logger.debug("setting deduplication_on_engagment to %s for %i", str(deduplication_on_engagement), eng.id)
1270+
logger.debug("setting deduplication_on_engagment to %s for %i", deduplication_on_engagement, eng.id)
12711271
eng.deduplication_on_engagement = deduplication_on_engagement
12721272
eng.save()
12731273

unittests/test_false_positive_history_logic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ def assert_finding(self, finding, false_p, duplicate=None, not_pk=None,
18251825

18261826
def set_dedupe_inside_engagement(self, deduplication_on_engagement):
18271827
for eng in Engagement.objects.all():
1828-
logger.debug("setting deduplication_on_engagment to %s for %i", str(deduplication_on_engagement), eng.id)
1828+
logger.debug("setting deduplication_on_engagment to %s for %i", deduplication_on_engagement, eng.id)
18291829
eng.deduplication_on_engagement = deduplication_on_engagement
18301830
eng.save()
18311831

0 commit comments

Comments
 (0)