From 65d7756da27176698a3467edc1b8c92aedb41eac Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Wed, 27 May 2026 08:33:36 -0700 Subject: [PATCH] Resolve pre-existing ruff lint errors blocking CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five pre-existing lint errors on dev baseline (all introduced May 25-26 before this branch was cut) were blocking CI on this PR. Cleared as courtesy fixes so the merge isn't gated on unrelated tech debt: - web_server.py:22613 — F811 duplicate `urlparse` import inside `_parse_itunes_link_url` (already imported at module top, line 20). Removed from the inline `from urllib.parse import parse_qs, urlparse`; kept `parse_qs` since that one is only used here. - core/listenbrainz_manager.py:746 — S110 silenced with `# noqa: S110 — best-effort lookup, delete proceeds either way`. Matches the existing project convention used in web_server.py:1693, core/watchlist/auto_scan.py:463, core/library_reorganize.py:548. - core/playlists/sources/listenbrainz.py:236 — B905 `zip()` without explicit `strict=`. Added `strict=False` — preserves existing behaviour where `matched` can legitimately be shorter than `match_indices` on partial discover failure. - core/playlists/sources/listenbrainz.py:273 — S110 silenced with `# noqa: S110 — caller falls back to last cached playlist on refresh failure`. - core/playlists/sources/soulsync_discovery.py:105 — S110 silenced with `# noqa: S110 — manager persists last_generation_error on failure; surface existing snapshot`. The existing multi-line comment that already explained the swallow was rolled into the noqa justification so the rule + reason live on one line. Ruff `python -m ruff check .` now passes; 664 discovery + metadata tests still pass. --- core/listenbrainz_manager.py | 2 +- core/playlists/sources/listenbrainz.py | 4 ++-- core/playlists/sources/soulsync_discovery.py | 4 +--- web_server.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/listenbrainz_manager.py b/core/listenbrainz_manager.py index ddae7ae8..efa16158 100644 --- a/core/listenbrainz_manager.py +++ b/core/listenbrainz_manager.py @@ -743,7 +743,7 @@ class ListenBrainzManager: ) row = cursor.fetchone() playlist_type = row[0] if row else '' - except Exception: + except Exception: # noqa: S110 — best-effort lookup, delete proceeds either way pass # Delete tracks first (SQLite FK CASCADE requires PRAGMA foreign_keys=ON) diff --git a/core/playlists/sources/listenbrainz.py b/core/playlists/sources/listenbrainz.py index 0c5f72ff..838cda15 100644 --- a/core/playlists/sources/listenbrainz.py +++ b/core/playlists/sources/listenbrainz.py @@ -233,7 +233,7 @@ class ListenBrainzPlaylistSource(PlaylistSource): return tracks out = list(tracks) - for slot_idx, result in zip(match_indices, matched): + for slot_idx, result in zip(match_indices, matched, strict=False): if not result: continue track = out[slot_idx] @@ -270,7 +270,7 @@ class ListenBrainzPlaylistSource(PlaylistSource): return None try: manager.update_all_playlists() - except Exception: + except Exception: # noqa: S110 — caller falls back to last cached playlist on refresh failure pass return self.get_playlist(playlist_id) diff --git a/core/playlists/sources/soulsync_discovery.py b/core/playlists/sources/soulsync_discovery.py index c648830c..d2cfec25 100644 --- a/core/playlists/sources/soulsync_discovery.py +++ b/core/playlists/sources/soulsync_discovery.py @@ -102,9 +102,7 @@ class SoulSyncDiscoveryPlaylistSource(PlaylistSource): variant=record.variant, profile_id=record.profile_id, ) - except Exception: - # Manager already persists ``last_generation_error`` on - # failure; surface the existing snapshot regardless. + except Exception: # noqa: S110 — manager persists last_generation_error on failure; surface existing snapshot pass return self.get_playlist(playlist_id) diff --git a/web_server.py b/web_server.py index 7e6209ed..268ec877 100644 --- a/web_server.py +++ b/web_server.py @@ -22610,7 +22610,7 @@ _APPLE_MUSIC_BUNDLE_SCRAPE_CAP = 8 def _parse_itunes_link_url(url): """Return {'type': 'album'|'track'|'playlist', 'id': str} for supported Apple links.""" import re - from urllib.parse import parse_qs, urlparse + from urllib.parse import parse_qs raw = (url or '').strip() if not raw: