[pydocstyle
] Split on first whitespace character (D403
)
#15082
Merged
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
This PR fixes an issue where Ruff's
D403
rule (first-word-uncapitalized
) was not detecting some single-word edge cases that are picked up bypydocstyle
.The change involves extracting the first word of the docstring by identifying the first whitespace character. This is consistent with
pydocstyle
which uses.split()
- see https://github.com/PyCQA/pydocstyle/blob/8d0cdfc93e86e096bb5753f07dc5c7c373e63837/src/pydocstyle/checker.py#L581C13-L581C64Example
Here is a playground example - https://play.ruff.rs/eab9ea59-92cf-4e44-b1a9-b54b7f69b178
pydocstyle
detects all five cases:Ruff (
0.8.4
) fails to catch example2 and example4.Test Plan