Fix ruff BLE001 lint failures and pin ruff version (WID-780) - #5
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
except Exceptioninnlp-service/main.py's Gemini API call to the specific exceptions it can actually raise (httpx.HTTPError,KeyError,ValueError,IndexError).# noqa: BLE001to the three blind excepts innlp-service/test_service.py— it's a standalone diagnostic script that must keep running through each check regardless of failure type.Optional[X]→X | None(UP045) inmain.py.ruff==0.16.0in.github/workflows/ci.ymlso 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.pyandtest_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-servicepasses locally with ruff 0.16.0 (the version now pinned in CI)Python lint (nlp-service)GitHub Actions check passes on this PR