Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False negative for D403 when the first sentence only has one word but the whole docstring is longer #13167

Closed
dscorbett opened this issue Aug 30, 2024 · 3 comments
Labels
rule Implementing or modifying a lint rule

Comments

@dscorbett
Copy link

D403 has a false negative when the docstring’s first word (tokenized by spaces) is not ASCII alphabetic and the docstring either contains a space or doesn’t end with ASCII terminal punctuation. This is similar to #10775. #10776 only fixed the case where a docstring contains no spaces and ends with ASCII terminal punctuation.

In the following example, f1 has a true positive and f2 has a false negative.

$ ruff --version
ruff 0.6.3
$ cat d403.py
def f1():
    """footles."""
def f2():
    """footles.

    This is a no-op.
    """
$ ruff check -q --output-format concise --isolated --select D403 d403.py
d403.py:2:5: D403 [*] First word of the first line should be capitalized: `footles` -> `Footles`
@MichaReiser
Copy link
Member

The current behavior is insofar intentional that it matches pydocstyle

We would have to take a closer look why pydocstyle deliberately excludes all first words that contain any non ASCII characters.

@MichaReiser MichaReiser added rule Implementing or modifying a lint rule needs-decision Awaiting a decision from a maintainer and removed needs-decision Awaiting a decision from a maintainer labels Sep 2, 2024
@dscorbett
Copy link
Author

Ruff’s D403 already doesn’t match pydocstyle: Ruff flags f1 and pydocstyle doesn’t. This is intentional due to #10775. As long as Ruff’s behavior is different, I think it should be self-consistent.

@InSyncWithFoo
Copy link
Contributor

This seems to be reseolved by #15082.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

3 participants