diff --git a/dojo/finding/views.py b/dojo/finding/views.py index ec25352a903..9af0e099ebe 100644 --- a/dojo/finding/views.py +++ b/dojo/finding/views.py @@ -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) ) diff --git a/dojo/importers/default_reimporter.py b/dojo/importers/default_reimporter.py index 0c4159ed669..dfe7fe4027e 100644 --- a/dojo/importers/default_reimporter.py +++ b/dojo/importers/default_reimporter.py @@ -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 ] diff --git a/dojo/product/views.py b/dojo/product/views.py index 654169363dc..2a60696aa35 100644 --- a/dojo/product/views.py +++ b/dojo/product/views.py @@ -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: @@ -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: @@ -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: diff --git a/dojo/test/views.py b/dojo/test/views.py index 8c9f42d586a..2ea9b249058 100644 --- a/dojo/test/views.py +++ b/dojo/test/views.py @@ -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) ) diff --git a/unittests/tools/test_tfsec_parser.py b/unittests/tools/test_tfsec_parser.py index 814a5154d61..c7ce3927771 100644 --- a/unittests/tools/test_tfsec_parser.py +++ b/unittests/tools/test_tfsec_parser.py @@ -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