Skip to content
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

D413 is enforcing excessive whitespace #9877

Closed
BrentWilkins opened this issue Feb 7, 2024 · 1 comment · Fixed by #9878
Closed

D413 is enforcing excessive whitespace #9877

BrentWilkins opened this issue Feb 7, 2024 · 1 comment · Fixed by #9878
Assignees
Labels
bug Something isn't working docstring Related to docstring linting or formatting

Comments

@BrentWilkins
Copy link

It seems that the change in this PR is exposing a bug in the D413. Ruff is calling this docstring bad:

"""Make a summary line.

Note:
----
  Per the code comment the next two lines are blank. "// The first blank line is the line containing the closing
      triple quotes, so we need at least two."

"""

Missing blank line after last section ("Note") Ruff(D413)

I can't see what's different between what I have and the Use instead: section of the documentation.

I can make Ruff happy by adding excessive blank lines:

"""Make a summary line.

Note:
----
  Per the code comment the next two lines are blank. "// The first blank line is the line containing the closing
      triple quotes, so we need at least two."


"""
@charliermarsh
Copy link
Member

Thanks!

@charliermarsh charliermarsh added bug Something isn't working docstring Related to docstring linting or formatting labels Feb 7, 2024
@charliermarsh charliermarsh self-assigned this Feb 7, 2024
charliermarsh added a commit that referenced this issue Feb 7, 2024
## Summary

Given:

```python
"""Make a summary line.

Note:
----
  Per the code comment the next two lines are blank. "// The first blank line is the line containing the closing
      triple quotes, so we need at least two."

"""
```

It turns out we excluded the line ending in `"""`, because it's empty
(unlike for functions, where it consists of the indent). This PR changes
the `following_lines` iterator to always include the trailing newline,
which gives us correct and consistent handling between function and
module-level docstrings.

Closes #9877.
nkxxll pushed a commit to nkxxll/ruff that referenced this issue Mar 10, 2024
…#9878)

## Summary

Given:

```python
"""Make a summary line.

Note:
----
  Per the code comment the next two lines are blank. "// The first blank line is the line containing the closing
      triple quotes, so we need at least two."

"""
```

It turns out we excluded the line ending in `"""`, because it's empty
(unlike for functions, where it consists of the indent). This PR changes
the `following_lines` iterator to always include the trailing newline,
which gives us correct and consistent handling between function and
module-level docstrings.

Closes astral-sh#9877.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstring Related to docstring linting or formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants