-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Errors in multiline docstrings point to the first line of the string #10736
Comments
@ts933 would you mind providing a minimal code example that demonstrates the problem? It would help us to understand what you're asking for or consider a bug. Thank you |
Code with 4 errors all pointing to the same line --> 10
file.py:10:5: D410 [] Missing blank line after section ("Args") |
I would need to look into what the reason for this is. @charliermarsh any chance it is so that the noqa comments work for multiline docstrings (because they match on the start of the line?) |
No, that shouldn’t be necessary for the noqa enforcement. I can take a look at this. My guess is we highlight the whole docstring, and so the start character is indeed the first line? Not sure though, I’ll look later. |
Yeah, these rules just use the range of the docstring. We could consider refining them. |
…10740) ## Summary We may not have had access to this in the past, but in short, if the diagnostic is related to a specific section of a docstring, it seems better to highlight the section (via the header) than the _entire_ docstring. This should be completely compatible with existing `# noqa` since it's always inside of a multi-line string anyway, and in such cases the `# noqa` is always placed at the end of the multiline string. Closes #10736.
…stral-sh#10740) ## Summary We may not have had access to this in the past, but in short, if the diagnostic is related to a specific section of a docstring, it seems better to highlight the section (via the header) than the _entire_ docstring. This should be completely compatible with existing `# noqa` since it's always inside of a multi-line string anyway, and in such cases the `# noqa` is always placed at the end of the multiline string. Closes astral-sh#10736.
ruff version==0.2.1
pyproject.toml
The text was updated successfully, but these errors were encountered: