Skip to content

Commit

Permalink
Ruff: Fix RUF056 (#11501)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik authored Jan 15, 2025
1 parent d959bdd commit 67da866
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dojo/finding/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def get_typed_note_form(self, request: HttpRequest, context: dict):
def get_form(self, request: HttpRequest, context: dict):
return (
self.get_typed_note_form(request, context)
if context.get("note_type_activation", 0)
if context.get("note_type_activation")
else self.get_note_form(request)
)

Expand Down
2 changes: 1 addition & 1 deletion dojo/importers/default_reimporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def process_results(
Determine how to to return the results based on whether the process was
ran asynchronous or not
"""
if not kwargs.get("sync", False):
if not kwargs.get("sync"):
serialized_new_items = [
serialize("json", [finding]) for finding in self.new_items
]
Expand Down
6 changes: 3 additions & 3 deletions dojo/product/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def view_product_metrics(request, pid):
unix_timestamp = (tcalendar.timegm(date.timetuple()) * 1000)

# Open findings
if open_findings_dict.get(finding.get("id", None), None):
if open_findings_dict.get(finding.get("id", None)):
if unix_timestamp not in critical_weekly:
critical_weekly[unix_timestamp] = {"count": 0, "week": html_date}
if unix_timestamp not in high_weekly:
Expand Down Expand Up @@ -651,7 +651,7 @@ def view_product_metrics(request, pid):
open_objs_by_severity[finding.get("severity")] += 1

# Close findings
elif closed_findings_dict.get(finding.get("id", None), None):
elif closed_findings_dict.get(finding.get("id", None)):
if unix_timestamp in open_close_weekly:
open_close_weekly[unix_timestamp]["closed"] += 1
else:
Expand All @@ -662,7 +662,7 @@ def view_product_metrics(request, pid):
closed_objs_by_severity[finding.get("severity")] += 1

# Risk Accepted findings
if accepted_findings_dict.get(finding.get("id", None), None):
if accepted_findings_dict.get(finding.get("id", None)):
if unix_timestamp in open_close_weekly:
open_close_weekly[unix_timestamp]["accepted"] += 1
else:
Expand Down
2 changes: 1 addition & 1 deletion dojo/test/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def get_typed_note_form(self, request: HttpRequest, context: dict):
def get_form(self, request: HttpRequest, context: dict):
return (
self.get_typed_note_form(request, context)
if context.get("note_type_activation", 0)
if context.get("note_type_activation")
else self.get_note_form(request)
)

Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_tfsec_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_parse_many_findings_current(self):

severities = {}
for finding in findings:
if severities.get(finding.severity, None):
if severities.get(finding.severity):
numSeverity = severities.get(finding.severity)
numSeverity += 1
severities[finding.severity] = numSeverity
Expand Down

0 comments on commit 67da866

Please sign in to comment.