Skip to content

PYTHON-6261 Opt into ruff D rules for whitespace and escapes - #3213

Merged
NoahStapp merged 3 commits into
mongodb:mainfrom
NoahStapp:PYTHON-6261
Nov 12, 2026
Merged

NoahStapp merged 3 commits into
mongodb:mainfrom
NoahStapp:PYTHON-6261

Conversation

@NoahStapp

Copy link
Copy Markdown
Contributor

PYTHON-6261

Changes in this PR

Opt into the ruff D rules D202, D209, D301, and D403 and make the required docstring changes to pass them.

Test Plan

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 11, 2026 20:58
@NoahStapp
NoahStapp requested review from sleepyStick and a balanced review from Copilot November 11, 2026 20:58

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 remain to be resolved.

No open issues 🎉

What changed in this PR

This PR standardizes docstrings across PyMongo, BSON, GridFS, and supporting tests by enabling additional Ruff checks. Changes are limited to lint configuration, docstrings, and whitespace; executable logic is unchanged.

Changes:

  • Enable Ruff rules D202, D209, D301, and D403 with the PEP 257 convention.
  • Normalize docstring spacing, closing quotes, and capitalization.
  • Use raw docstrings for escape sequences and correct a Sphinx version directive.
File Description
test/​test_ssl.py Remove blank line after a test docstring.
test/​test_raw_bson_shared.py Place closing docstring quotes on their own line.
test/​test_monitor.py Normalize multiline docstring closing quotes.
test/​test_index_management.py Remove blank lines after test docstrings.
test/​test_bson.py Remove blank line after a test docstring.
test/​test_bson_binary_vector.py Normalize class docstring closing quotes.
test/​asynchronous/​test_ssl.py Remove blank line after a test docstring.
test/​asynchronous/​test_monitor.py Normalize multiline docstring closing quotes.
test/​asynchronous/​test_index_management.py Remove blank lines after test docstrings.
pyproject.toml Enable four docstring rules and the PEP 257 convention.
pymongo/​topology_description.py Rewrite docstring summary with initial capitalization.
pymongo/​synchronous/​mongo_client.py Remove blank lines after method docstrings.
pymongo/​synchronous/​database.py Use a raw docstring for the regex example.
pymongo/​pool_options.py Normalize multiline docstring closing quotes.
pymongo/​asynchronous/​mongo_client.py Remove blank lines after method docstrings.
pymongo/​asynchronous/​database.py Use a raw docstring for the regex example.
pymongo/​_asyncio_lock.py Normalize module docstring closing quotes.
gridfs/​synchronous/​grid_file.py Use a raw docstring for the newline example.
gridfs/​grid_file_shared.py Remove blank line after a helper docstring.
gridfs/​asynchronous/​grid_file.py Use a raw docstring for the newline example.
fuzz/​build_corpus.py Normalize multiline docstring closing quotes.
bson/​json_util.py Make the module docstring raw.
bson/​errors.py Correct Sphinx directive syntax and closing quotes.
bson/​codec_options.py Use a raw docstring and simplify example escapes.
bson/​binary.py Remove blank line after a method docstring.
bson/​__init__.py Use a raw docstring and remove extra spacing.
.evergreen/​scripts/​test_generate_config.py Normalize multiline test docstring closing quotes.

Review effort: Balanced

sleepyStick
sleepyStick previously approved these changes Nov 11, 2026
@NoahStapp
NoahStapp merged commit 31ad1a2 into mongodb:main Nov 12, 2026
83 checks passed
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.

3 participants