You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
According to Google's Style Guide, if a line in the Args section needs to be broken due to length, you should use a hanging indent for the next lines [ref].
If the description is too long to fit on a single 80-character line, use a hanging indent of 2 or 4 spaces more than the parameter name (be consistent with the rest of the docstrings in the file).
I guess this is also the case for other valid sections in the docstring.
Example
This must be a case of misconfiguration, but running pydocstyle --convetion=google doesn't suggest those fixes in my case. For example, I would expect the following docstring
defadd(a: int, b: int) ->int:
"""Add a and b. Args: a (int): Number 1 to be added. This line is intentionally long to cause a mandatory break. b (int): Number 2 to be added. This line is intentionally long to cause a mandatory break. """returna+b
to be flagged as incorrect because the correct Google-style docstring would be
defadd(a: int, b: int) ->int:
"""Add a and b. Args: a (int): Number 1 to be added. This line is intentionally long to cause a mandatory break. b (int): Number 2 to be added. This line is intentionally long to cause a mandatory break. """returna+b
Instead, pydocstyle doesn't complain.
The correct hanging indent can be detected by measuring the hanging indent between Args: and the first arg, for example.
Am I doing something wrong?
Environment
Mac OS 12.5.1 on an Intel Mac.
Python 3.10.8.
pydocstyle 6.2.2.
The text was updated successfully, but these errors were encountered:
sebastian-correa
changed the title
Google style handing indent on line break
Google style hanging indent on line break
Jan 10, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue
According to Google's Style Guide, if a line in the
Args
section needs to be broken due to length, you should use a hanging indent for the next lines [ref].I guess this is also the case for other valid sections in the docstring.
Example
This must be a case of misconfiguration, but running
pydocstyle --convetion=google
doesn't suggest those fixes in my case. For example, I would expect the following docstringto be flagged as incorrect because the correct Google-style docstring would be
Instead,
pydocstyle
doesn't complain.The correct hanging indent can be detected by measuring the hanging indent between
Args:
and the first arg, for example.Am I doing something wrong?
Environment
pydocstyle
6.2.2.The text was updated successfully, but these errors were encountered: