[pydocstyle-D405] Allow using parameters as a sub-section header#9894
Merged
charliermarsh merged 5 commits intoFeb 9, 2024
Conversation
pydocstyle-D405] Allow using *parameters* as a sub-section headerpydocstyle-D405] Allow using parameters as a sub-section header
Contributor
|
ed05447 to
960a60f
Compare
Contributor
Author
|
Note: check that the condition still holds if an arg name is different than Parameters but some other section name e.g returns. |
Member
|
@mikeleppane - Can you post an example? |
Contributor
Author
|
Sorry, I forgot to add a test case for this. def foo(returns: int):
"""
Parameters
-‐-----------------
returns:
some value
""" |
Member
|
Ahh ok yes, the change I made here doesn't cover that case. |
Member
|
I have an idea for it, thanks. |
Member
|
Thanks as always @mikeleppane! |
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this pull request
Mar 10, 2024
…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 <mikko.leppanen@vaisala.com> Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 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