🐛 | Code quality fixes
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m43s

- config.py: move 'import shutil' to module level
- player.py: unify type hints, narrow except, add debug log
- discord_rpc.py: replace broad except Exception with specific types
- gui.py: remove unused import; replace lambda closures with method refs; fix closure scope bug; extract _populate_list_page() to remove duplicate code; add public accessors; make flush_volume public; add AudioVisualizer.reset_activity()
- tests: replace unused _f variable with Path.touch()
This commit is contained in:
2026-06-04 18:26:46 +03:00
parent 82a34a0a55
commit daf9c5739c
5 changed files with 85 additions and 63 deletions

View File

@@ -116,7 +116,7 @@ class DiscordRPC:
log.warning("Discord not running RPC unavailable")
self._connected = False
return False
except Exception as exc:
except (OSError, RuntimeError, DiscordNotFound) as exc:
log.debug("Discord RPC connect failed: %s", exc)
self._connected = False
return False
@@ -125,7 +125,7 @@ class DiscordRPC:
if self._rpc:
try:
self._rpc.close()
except Exception:
except (OSError, RuntimeError):
pass
self._rpc = None
self._connected = False
@@ -139,7 +139,7 @@ class DiscordRPC:
if self._connected and self._rpc is not None:
try:
self._rpc.clear()
except Exception:
except (OSError, RuntimeError):
self._connected = False
return
@@ -162,7 +162,7 @@ class DiscordRPC:
start=start,
end=end_ts,
)
except Exception as exc:
except (OSError, RuntimeError) as exc:
log.debug("RPC update failed: %s", exc)
self._connected = False