Skip to content

Commit

Permalink
Ruff: Fix for version 0.7.4 (#11270)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik authored Nov 22, 2024
1 parent 47c7213 commit 70f626f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dojo/jira_link/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def webhook(request, secret=None):
findings = None
# Determine what type of object we will be working with
if jissue.finding:
logging.debug(f"Received issue update for {jissue.jira_key} for finding {jissue.finding.id}")
logger.debug(f"Received issue update for {jissue.jira_key} for finding {jissue.finding.id}")
findings = [jissue.finding]
elif jissue.finding_group:
logging.debug(f"Received issue update for {jissue.jira_key} for finding group {jissue.finding_group}")
logger.debug(f"Received issue update for {jissue.jira_key} for finding group {jissue.finding_group}")
findings = jissue.finding_group.findings.all()
elif jissue.engagement:
return webhook_responser_handler("debug", "Update for engagement ignored")
Expand Down Expand Up @@ -228,7 +228,7 @@ def check_for_and_create_comment(parsed_json):
jissue = JIRA_Issue.objects.get(jira_id=jid)
except JIRA_Instance.DoesNotExist:
return webhook_responser_handler("info", f"JIRA issue {jid} is not linked to a DefectDojo Finding")
logging.debug(f"Received issue comment for {jissue.jira_key}")
logger.debug(f"Received issue comment for {jissue.jira_key}")
logger.debug("jissue: %s", vars(jissue))

jira_usernames = JIRA_Instance.objects.values_list("username", flat=True)
Expand Down
2 changes: 1 addition & 1 deletion dojo/management/commands/print_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def handle(self, *args, **options):
value = getattr(settings, attr)
a_dict[attr] = value

logging.info(pformat(a_dict))
logger.info(pformat(a_dict))
6 changes: 3 additions & 3 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,7 @@ def clean(self):
action_string = "Postgres does not accept NULL character. Attempting to replace with %00..."
for remove_str in null_char_list:
self.path = self.path.replace(remove_str, "%00")
logging.error(f'Path "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
logger.error(f'Path "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
if self.path == "":
self.path = None

Expand All @@ -1799,7 +1799,7 @@ def clean(self):
action_string = "Postgres does not accept NULL character. Attempting to replace with %00..."
for remove_str in null_char_list:
self.query = self.query.replace(remove_str, "%00")
logging.error(f'Query "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
logger.error(f'Query "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
if self.query == "":
self.query = None

Expand All @@ -1812,7 +1812,7 @@ def clean(self):
action_string = "Postgres does not accept NULL character. Attempting to replace with %00..."
for remove_str in null_char_list:
self.fragment = self.fragment.replace(remove_str, "%00")
logging.error(f'Fragment "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
logger.error(f'Fragment "{old_value}" has invalid format - It contains the NULL character. The following action was taken: {action_string}')
if self.fragment == "":
self.fragment = None

Expand Down
2 changes: 1 addition & 1 deletion dojo/notes/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ def delete_related_notes(obj):
if not hasattr(obj, "notes"):
logger.warning(f"Attempted to delete notes from object type {type(obj)} without 'notes' attribute.")
return
logging.debug(f"Deleting {obj.notes.count()} notes for {type(obj).__name__} {obj.id}")
logger.debug(f"Deleting {obj.notes.count()} notes for {type(obj).__name__} {obj.id}")
obj.notes.all().delete()
2 changes: 1 addition & 1 deletion dojo/notes/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def delete_note_history(note):
logging.debug(f"Deleting history for note {note.id}")
logger.debug(f"Deleting history for note {note.id}")
note.history.all().delete()


Expand Down
4 changes: 2 additions & 2 deletions dojo/tools/api_sonarqube/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def import_issues(self, test):
organization=organization,
branch=test.branch_tag,
)
logging.info(
logger.info(
f'Found {len(issues)} issues for component {component["key"]}',
)

Expand Down Expand Up @@ -247,7 +247,7 @@ def import_hotspots(self, test):
organization=organization,
branch=test.branch_tag,
)
logging.info(
logger.info(
f'Found {len(hotspots)} hotspots for project {component["key"]}',
)
sonarUrl = client.sonar_api_url[:-3] # [:-3] removes the /api part of the sonarqube/cloud URL
Expand Down
2 changes: 1 addition & 1 deletion requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.7.3
ruff==0.7.4

0 comments on commit 70f626f

Please sign in to comment.