Skip to content

PYTHON-6281 Enable all ruff FURB rules - #3231

Open
NoahStapp wants to merge 2 commits into
mongodb:mainfrom
NoahStapp:PYTHON-6281
Open

NoahStapp wants to merge 2 commits into
mongodb:mainfrom
NoahStapp:PYTHON-6281

Conversation

@NoahStapp

Copy link
Copy Markdown
Contributor

PYTHON-6281

Changes in this PR

Enable the entire suite of ruff FURB rules and make the required code changes to pass them.

Test Plan

Existing test suite.

Checklist

Checklist for Author

  • [ ] Did you update the changelog (if necessary)?
  • [ ] Is there test coverage?
  • [ ] Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

@NoahStapp
NoahStapp requested a review from a team as a code owner November 17, 2026 14:57
@NoahStapp
NoahStapp requested review from aclark4life and a balanced review from Copilot November 17, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Ruff FURB enablement and related lint-driven code changes.

No open issues 🎉

What changed in this PR

Enables Ruff’s full FURB rule family and updates driver code, tests, and tooling to satisfy the new lint checks.

Changes:

  • Adds FURB to Ruff’s enabled rules.
  • Replaces single-item membership checks with equality comparisons.
  • Simplifies client-list fallbacks in asynchronous tests and their generated synchronous counterparts.
File Description
test/​unified_format.py Simplifies the generated synchronous session-cleanup client fallback.
test/​test_transactions.py Simplifies the generated synchronous fail-point client fallback.
test/​test_bson_binary_vector.py Uses equality for the FLOAT32 type check.
test/​asynchronous/​unified_format.py Simplifies the session-cleanup client fallback.
test/​asynchronous/​test_transactions.py Simplifies the fail-point client fallback.
pyproject.toml Enables the FURB rule family.
pymongo/​errors.py Uses equality to identify timeout error code 50.
pymongo/​common.py Uses equality for the ALLOWED_HOSTS property check.
.evergreen/​scripts/​resync_all_specs.py Uses equality when excluding the asynchronous directory.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants