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
Summary:
Ruff is flagging a D205 warning (blank line required) on docstrings even though the code is compliant with the rule.
The script complies with pydocstyle checks.
Steps to reproduce:
Create a python script file (myFile.py) which with below lines.
"""
This script processes images in a folder, extracts metadata,
and displays metadata.
See ReadMe for more details.
"""
import os
import subprocess
import sys
Run command "ruff check myFile.py"
Actual output:
myFile.py:1:1: D205 1 blank line required between summary line and description
|
1 | / """
2 | | This script processes images in a folder, extracts metadata,
3 | | and displays metadata.
4 | |
5 | | See ReadMe for more details.
6 | | """
| |___^ D205
7 |
8 | import cv2
|
= help: Insert single blank line
Expected behavior:
Ruff should not flag this docstring with a D205 warning.
Version:ruff-0.9.3
The text was updated successfully, but these errors were encountered:
I can reproduce this with this code and ruff check --select D205 d205.py. I'll have to check the intention behind D205 to know if this is a bug or intended behavior, but I also noticed that if you put the whole first/summary line on a single line, it doesn't trigger D205:
"""This script processes images in a folder, extracts metadata, and displays metadata.See ReadMe for more details."""importosimportsubprocessimportsys
I think the rule only checks for first line without considering whether the line actually finishes the sentence or not. So, it's seeing that there's no blank line after "extracts metadata," which triggers the diagnostic. The PEP does specify "one-line summary" but I can't find if that allows the summary itself to be multiline, I think it doesn't. If so, then this is working as expected. What do you think @ntBre ?
I think you're right that it's working as intended. From PEP 257:
Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description. The summary line may be used by automatic indexing tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line.
The numpy and Google style guides linked from the pydocstyle docs are similar, with Google's probably being the clearest:
A docstring should be organized as a summary line (one physical line not exceeding 80 characters)
Description
Summary:
Ruff is flagging a D205 warning (blank line required) on docstrings even though the code is compliant with the rule.
The script complies with pydocstyle checks.
Steps to reproduce:
Create a python script file (myFile.py) which with below lines.
Run command "ruff check myFile.py"
Actual output:
Expected behavior:
Ruff should not flag this docstring with a D205 warning.
Version:
ruff-0.9.3
The text was updated successfully, but these errors were encountered: