Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff: Fix RUF056 #11501

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading