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
When W291 (trailing-whitespace) is enabled, ruff warns about trailing whitespace in multiline strings.
When --fix is passed, ruff modifies the multiline string. This could result in a behavior change of the python code.
Repro:
# repro.pystring="""this line has trailing whitespace """
$ ruff repro.py --isolated --select W291
repro.py:3:34: W291 [*] Trailing whitespace
Found 1 error.
[*] 1 potentially fixable with the --fix option.
$ ruff repro.py --isolated --select W291 --fix # This modifies the multiline string!
Found 1 error (1 fixed, 0 remaining).
$ ruff --version
ruff 0.0.278
When
W291
(trailing-whitespace) is enabled, ruff warns about trailing whitespace in multiline strings.When
--fix
is passed, ruff modifies the multiline string. This could result in a behavior change of the python code.Repro:
I noticed that the implementation
trailing_whitespace
categorizes the--fix
action asFix::safe_edit
. I feel that modifying a multiline string is not safe; it can change the behavior of my python code. The doc forApplicability::Safe
say:I feel that this does not apply to
W291
as implemented.The text was updated successfully, but these errors were encountered: