Skip to content

Fix ruff BLE001 lint failures and pin ruff version (WID-780) - #5

Merged
WiderDeveloper merged 1 commit into
mainfrom
wid-780-ruff-lint-fixes
Jul 23, 2026
Merged

Fix ruff BLE001 lint failures and pin ruff version (WID-780)#5
WiderDeveloper merged 1 commit into
mainfrom
wid-780-ruff-lint-fixes

Conversation

@WiderDeveloper

Copy link
Copy Markdown
Contributor

Summary

  • Narrows the blind except Exception in nlp-service/main.py's Gemini API call to the specific exceptions it can actually raise (httpx.HTTPError, KeyError, ValueError, IndexError).
  • Adds justified # noqa: BLE001 to the three blind excepts in nlp-service/test_service.py — it's a standalone diagnostic script that must keep running through each check regardless of failure type.
  • Applies ruff's auto-fixes for import ordering (I001) and Optional[X]X | None (UP045) in main.py.
  • Pins ruff==0.16.0 in .github/workflows/ci.yml so lint results stop drifting between CI runs.

Note: the original issue (WID-780) described this as "9 BLE001 errors in test_service.py," but the job was actually failing on 9 total errors across main.py and test_service.py (I001, UP045, BLE001) due to the unpinned ruff version picking up a newer default rule set. Fixed the full set so the job is actually green, not just the BLE001 count.

Test plan

  • ruff check nlp-service passes locally with ruff 0.16.0 (the version now pinned in CI)
  • Confirm the Python lint (nlp-service) GitHub Actions check passes on this PR

Ruff was unpinned in the lint job, so drift pulled in a newer default
rule set (I001, UP045, BLE001) that flagged 9 pre-existing violations
in nlp-service/main.py and test_service.py. Narrow the Gemini API
exception handling in main.py, add justified noqa comments for the
intentionally broad catches in the diagnostic test_service.py script,
apply the auto-fixable import-order/typing fixes, and pin ruff to
0.16.0 in CI so future runs are reproducible.
@WiderDeveloper
WiderDeveloper merged commit 9b496b8 into main Jul 23, 2026
2 checks passed
@WiderDeveloper
WiderDeveloper deleted the wid-780-ruff-lint-fixes branch July 23, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant