-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
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.