-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[pydocstyle-D405
] Allow using parameters
as a sub-section header
#9894
[pydocstyle-D405
] Allow using parameters
as a sub-section header
#9894
Conversation
pydocstyle-D405
] Allow using *parameters* as a sub-section headerpydocstyle-D405
] Allow using parameters
as a sub-section header
|
ed05447
to
960a60f
Compare
Note: check that the condition still holds if an arg name is different than Parameters but some other section name e.g returns. |
@mikeleppane - Can you post an example? |
Sorry, I forgot to add a test case for this. def foo(returns: int):
"""
Parameters
-‐-----------------
returns:
some value
""" |
Ahh ok yes, the change I made here doesn't cover that case. |
I have an idea for it, thanks. |
Thanks as always @mikeleppane! |
…stral-sh#9894) ## Summary This review contains a fix for [D405](https://docs.astral.sh/ruff/rules/capitalize-section-name/) (capitalize-section-name) The problem is that Ruff considers the sub-section header as a normal section if it has the same name as some section name. For instance, a function/method has an argument named "parameters". This only applies if you use Numpy style docstring. See: [ISSUE](astral-sh#9806) The following will not raise D405 after the fix: ```python def some_function(parameters: list[str]): """A function with a parameters parameter Parameters ---------- parameters: A list of string parameters """ ... ``` ## Test Plan ```bash cargo test ``` --------- Co-authored-by: Mikko Leppänen <[email protected]> Co-authored-by: Charlie Marsh <[email protected]>
Summary
This review contains a fix for D405 (capitalize-section-name)
The problem is that Ruff considers the sub-section header as a normal section if it has the same name as some section name. For instance, a function/method has an argument named "parameters". This only applies if you use Numpy style docstring.
See: ISSUE
The following will not raise D405 after the fix:
Test Plan
cargo test