Catches the silent excepts the awk-based earlier sweeps missed:
- Bare `except:` followed by `pass` (also swallows KeyboardInterrupt
and SystemExit — actively wrong). Upgraded to `except Exception as
e: logger.debug("...: %s", e)`. ~14 sites across connection_detect,
soulseek_client, listenbrainz_manager, watchlist_scanner,
youtube_client, navidrome_client, jellyfin_client, web_server.
- `except Exception:` + pass that the awk pattern missed (e.g.
multi-line or unusual whitespace). ~31 sites across automation_engine,
database_update_worker, music_database, spotify_client, web_server,
others.
- 14 legitimate cleanup sites left silent with explicit `# noqa: S110`
+ comment explaining why (atexit handlers, finally-block conn.close
calls). Logging during shutdown can itself crash because file handles
get torn down before the handler fires.
Also enables `S110` rule in pyproject.toml so this pattern fails CI
going forward — drift fails at PR review instead of at runtime against
a wedged worker thread. Tests path keeps S110 ignored (test fixtures
legitimately use try-except-pass for cleanup).
Adds a WHATS_NEW entry to helper.js summarizing the full #369 sweep.
Verified: `python -m ruff check .` → All checks passed.
Verified: `python -m pytest tests/` → 2188 passed.
Closes #369
23 lines
709 B
TOML
23 lines
709 B
TOML
[tool.ruff]
|
|
target-version = "py311"
|
|
line-length = 160
|
|
|
|
[tool.ruff.lint]
|
|
# Start lenient — catch real bugs, not style nits
|
|
# E: pycodestyle errors, F: pyflakes, UP: pyupgrade, B: bugbear
|
|
select = ["F", "E9", "W6", "B", "S110"]
|
|
# Ignore rules that will flag too much in an existing codebase
|
|
ignore = [
|
|
"F401", # unused imports (too noisy initially)
|
|
"F841", # unused variables
|
|
"E501", # line length (handled by line-length setting)
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# Tests can use assert, magic values, etc.
|
|
"tests/**" = ["B", "F", "S110"]
|
|
|
|
[tool.pytest.ini_options]
|
|
markers = [
|
|
"soundcloud_live: live SoundCloud integration test (network-dependent, run with -m soundcloud_live)",
|
|
]
|