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

D403 first-line-capitalized lint not alerting when the first line is after a newline #14890

Open
yoav-alexander opened this issue Dec 10, 2024 · 0 comments
Labels
bug Something isn't working docstring Related to docstring linting or formatting help wanted Contributions especially welcome

Comments

@yoav-alexander
Copy link

My Ruff version is 0.8.2.

When using first-line-capitalized (D403) in conjunction with multi-line-summary-second-line (D213)
ruff fails to alert about the first line missing capitalization:

def fibonacci(n: int) -> int:
    """
    calculate the nth Fibonacci number.

    The Fibonacci sequence is defined as:
        F(0) = 0, F(1) = 1
        F(n) = F(n-1) + F(n-2) for n > 1

    Args:
        n (int): The position in the Fibonacci sequence (must be non-negative).
    ...
    """

The ruff output is :

All checks passed!

I think the correct action would be to alert the user about the missing capitalization since the lint is basically useless when using D213.
Moreover, and most importantly, this is a deviation from how pydocstyle works, from which both of those alerts are
derived.

pydocstyle:

main.py:3 in public function `fibonacci`:
        D403: First word of the first line should be properly capitalized ('Calculate', not 'calculate')

If this change is accepted I think there are merits to renaming first-line-capitalized (D403)
to something like docstring-start-capitalized to avoid confusion with multi-line-summary-second-line (D213)
and multi-line-summary-first-line (D212) which are all derived from pydocstyle.

@AlexWaygood AlexWaygood added docstring Related to docstring linting or formatting bug Something isn't working help wanted Contributions especially welcome labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstring Related to docstring linting or formatting help wanted Contributions especially welcome
Projects
None yet
Development

No branches or pull requests

2 participants