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
defouter():
"""This is a docstring."""# This is a comment.definner():
returnreturninner
I see the following behaviour:
❯ ruff --versionruff 0.0.240
❯ ruff --select D202 bug.py
# ... no output ...
❯ black --versionblack, 23.1.0 (compiled: yes)Python (CPython) 3.10.9
❯ black --diff bug.py --- bug.py 2023-02-05 21:19:16.413892 +0000+++ bug.py 2023-02-05 21:19:22.497046 +0000@@ -1,7 +1,8 @@ def outer(): """This is a docstring."""+ # This is a comment. def inner(): return return inner()would reformat bug.pyAll done! ✨ 🍰 ✨1 file would be reformatted.
❯ black bug.py reformatted bug.pyAll done! ✨ 🍰 ✨1 file reformatted.
❯ ruff --select D202 bug.py bug.py:2:5: D202 No blank lines allowed after function docstring (found 1)Found 1 error.1 potentially fixable with the --fix option.
It seems that this works fine if the comment is removed. Black wants a blank line before and after a nested function. But black treats comment lines before the function as "attached" to the function. This doesn't happen with the D202 rule in ruff which treats them as separate. We should follow black's lead here.
The text was updated successfully, but these errors were encountered:
For the following code:
I see the following behaviour:
It seems that this works fine if the comment is removed. Black wants a blank line before and after a nested function. But black treats comment lines before the function as "attached" to the function. This doesn't happen with the
D202
rule in ruff which treats them as separate. We should follow black's lead here.The text was updated successfully, but these errors were encountered: