-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid raising
UP032
if format
call arguments contain multiline ex…
…pressions (#5971) ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Fix a regression introduced by #5638. A multiline expression can't be safely inserted into a format field. ### Example ``` > cat a.py "{}".format( [ 1, 2, 3, ] ) > cargo run -p ruff_cli -- check a.py --no-cache --select UP032 --fix Finished dev [unoptimized + debuginfo] target(s) in 0.07s Running `target/debug/ruff check a.py --no-cache --select UP032 --fix` error: Autofix introduced a syntax error in `a.py` with rule codes UP032: EOL while scanning string literal at byte offset 5 --- f"{[ 1, 2, 3, ]}" --- a.py:1:1: UP032 Use f-string instead of `format` call Found 1 error. ``` ## Test Plan New test cases
- Loading branch information
Showing
3 changed files
with
51 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters