-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[pydoclint
] Fix SyntaxError
from fixes with line continuations (D201
, D202
)
#19246
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks reasonable to me. Could the same happen with classes? I noticed blank_before_after_class.rs
in the same directory, and the implementation looks similar.
I do wonder if something like iterating over the
but I'm not totally sure if that's how it works. That might also skip the diagnostic entirely, which could also be reasonable. |
It looks like the same can happen with the before check ( |
Sorry I left this in kind of an ambiguous state. I'll merge this now and we can follow up on classes and the |
* main: [`pylint`] Extend invalid string character rules to include t-strings (#19355) Make TC010 docs example more realistic (#19356) Move RDJSON rendering to `ruff_db` (#19293) [`flake8-use-pathlib`] Skip single dots for `invalid-pathlib-with-suffix` (`PTH210`) on versions >= 3.14 (#19331) [`ruff`] Allow `strict` kwarg when checking for `starmap-zip` (`RUF058`) in Python 3.14+ (#19333) [ty] Reduce false positives for `TypedDict` types (#19354) [ty] Remove `ConnectionInitializer` (#19353) [ty] Use `Type::string_literal()` more (#19352) [ty] Add ecosystem-report workflow (#19349) [ty] Make use of salsa `Lookup` when interning values (#19347) [ty] Sync vendored typeshed stubs (#19345) [`pylint`] Make example error out-of-the-box (`PLE2502`) (#19272) [`pydoclint`] Fix `SyntaxError` from fixes with line continuations (`D201`, `D202`) (#19246)
* dcreager/merge-arguments: add types iterator add asserting constructor debug assert lengths remove unused From use FromIterator [`pylint`] Extend invalid string character rules to include t-strings (#19355) Make TC010 docs example more realistic (#19356) Move RDJSON rendering to `ruff_db` (#19293) [`flake8-use-pathlib`] Skip single dots for `invalid-pathlib-with-suffix` (`PTH210`) on versions >= 3.14 (#19331) [`ruff`] Allow `strict` kwarg when checking for `starmap-zip` (`RUF058`) in Python 3.14+ (#19333) [ty] Reduce false positives for `TypedDict` types (#19354) [ty] Remove `ConnectionInitializer` (#19353) [ty] Use `Type::string_literal()` more (#19352) [ty] Add ecosystem-report workflow (#19349) [ty] Make use of salsa `Lookup` when interning values (#19347) [ty] Sync vendored typeshed stubs (#19345) [`pylint`] Make example error out-of-the-box (`PLE2502`) (#19272) [`pydoclint`] Fix `SyntaxError` from fixes with line continuations (`D201`, `D202`) (#19246)
Summary
This PR fixes #7172 by suppressing the fixes for docstring-missing-returns (DOC201) / docstring-extraneous-returns (DOC202) if there is a surrounding line continuation character
\
that would make the fix cause a syntax error.To do this, the lints are changed from
AlwaysFixableViolation
toViolation
withFixAvailability::Sometimes
.In the case of
DOC201
, the fix is not given if the non-break line ends in a line continuation character\
. Note that lines are iterated in reverse from the docstring to the function definition.In the case of
DOC202
, the fix is not given if the docstring ends with a line continuation character\
.Test Plan
Added a test case.