Merge pull request #449 from grafuls/development #264
Annotations
6 errors
/home/runner/work/badfish/badfish/src/badfish/helpers/logger.py#L58
# Try to parse as is first
try:
new_dict = yaml.safe_load(message)
except yaml.YAMLError:
# If parsing fails, try to format the value as a quoted string
- lines = message.strip().split('\n')
+ lines = message.strip().split("\n")
formatted_lines = []
for line in lines:
- if ':' in line:
- key, value = line.split(':', 1)
+ if ":" in line:
+ key, value = line.split(":", 1)
value = value.strip()
# If value contains spaces or special characters, wrap in quotes
- if ' ' in value or any(c in value for c in '{}[](),:#'):
+ if " " in value or any(c in value for c in "{}[](),:#"):
value = f'"{value}"'
formatted_lines.append(f"{key}: {value}")
else:
formatted_lines.append(line)
- formatted_message = '\n'.join(formatted_lines)
+ formatted_message = "\n".join(formatted_lines)
new_dict = yaml.safe_load(formatted_message)
-
+
self.output_dict.update({self.host: new_dict.copy()})
self.host = None
else:
message = self.messages["badfish.helpers.logger"]
# Apply the same formatting logic for non-host messages
try:
new_dict = yaml.safe_load(message)
except yaml.YAMLError:
- lines = message.strip().split('\n')
+ lines = message.strip().split("\n")
formatted_lines = []
for line in lines:
- if ':' in line:
- key, value = line.split(':', 1)
+ if ":" in line:
+ key, value = line.split(":", 1)
value = value.strip()
- if ' ' in value or any(c in value for c in '{}[](),:#'):
+ if " " in value or any(c in value for c in "{}[](),:#"):
value = f'"{value}"'
formatted_lines.append(f"{key}: {value}")
else:
formatted_lines.append(line)
- formatted_message = '\n'.join(formatted_lines)
+ formatted_message = "\n".join(formatted_lines)
new_dict = yaml.safe_load(formatted_message)
-
+
self.output_dict.update(new_dict.copy())
except yaml.YAMLError as ex:
self.output_dict = {"unsupported_command": True}
def diff(self):
|
badfish/helpers/logger.py#L77
Blank line contains whitespace (W293)
|
/home/runner/work/badfish/badfish/src/badfish/main.py#L2159
if _response.status in [200, 201]:
self.logger.debug(f"Session successfully deleted for {self.host}")
elif _response.status == 404:
self.logger.debug(f"Session not found (404) for {self.host}, may have been already deleted")
else:
- self.logger.warning(f"Unexpected status {_response.status} when deleting session for {self.host}.")
+ self.logger.warning(
+ f"Unexpected status {_response.status} when deleting session for {self.host}."
+ )
except Exception as ex:
self.logger.warning(f"Failed to delete session for {self.host}: {ex}")
finally:
self.session_id = None
self.token = None
|
badfish/helpers/logger.py#L99
Blank line contains whitespace (W293)
|
badfish/helpers/logger.py#L101
Local variable 'ex' is assigned to but never used (F841)
|
badfish/main.py#L464
Local variable 'e' is assigned to but never used (F841)
|