forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write autofixer for ISC001 (astral-sh#4829)
- Loading branch information
1 parent
4667192
commit 09af896
Showing
4 changed files
with
303 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,13 @@ | |
b"abc" | ||
b"def" | ||
) | ||
|
||
_ = """a""" """b""" | ||
|
||
_ = f"""a""" f"""b""" | ||
|
||
_ = f"a" "b" | ||
|
||
_ = """a""" "b" | ||
|
||
_ = 'a' "b" |
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
93 changes: 91 additions & 2 deletions
93
...t_str_concat/snapshots/ruff__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,109 @@ | ||
--- | ||
source: crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs | ||
--- | ||
ISC.py:1:5: ISC001 Implicitly concatenated string literals on one line | ||
ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
1 | _ = "a" "b" "c" | ||
| ^^^^^^^ ISC001 | ||
2 | | ||
3 | _ = "abc" + "def" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:1:9: ISC001 Implicitly concatenated string literals on one line | ||
ℹ Fix | ||
1 |-_ = "a" "b" "c" | ||
1 |+_ = "ab" "c" | ||
2 2 | | ||
3 3 | _ = "abc" + "def" | ||
4 4 | | ||
|
||
ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
1 | _ = "a" "b" "c" | ||
| ^^^^^^^ ISC001 | ||
2 | | ||
3 | _ = "abc" + "def" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
1 |-_ = "a" "b" "c" | ||
1 |+_ = "a" "bc" | ||
2 2 | | ||
3 3 | _ = "abc" + "def" | ||
4 4 | | ||
|
||
ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
38 | ) | ||
39 | | ||
40 | _ = """a""" """b""" | ||
| ^^^^^^^^^^^^^^^ ISC001 | ||
41 | | ||
42 | _ = f"""a""" f"""b""" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
35 35 | b"def" | ||
36 36 | ) | ||
37 37 | | ||
38 |-_ = """a""" """b""" | ||
38 |+_ = """ab""" | ||
39 39 | | ||
40 40 | _ = f"""a""" f"""b""" | ||
41 41 | | ||
|
||
ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
40 | _ = """a""" """b""" | ||
41 | | ||
42 | _ = f"""a""" f"""b""" | ||
| ^^^^^^^^^^^^^^^^^ ISC001 | ||
43 | | ||
44 | _ = f"a" "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
37 37 | | ||
38 38 | _ = """a""" """b""" | ||
39 39 | | ||
40 |-_ = f"""a""" f"""b""" | ||
40 |+_ = f"""ab""" | ||
41 41 | | ||
42 42 | _ = f"a" "b" | ||
43 43 | | ||
|
||
ISC.py:42:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
42 | _ = f"""a""" f"""b""" | ||
43 | | ||
44 | _ = f"a" "b" | ||
| ^^^^^^^^ ISC001 | ||
45 | | ||
46 | _ = """a""" "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:44:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
44 | _ = f"a" "b" | ||
45 | | ||
46 | _ = """a""" "b" | ||
| ^^^^^^^^^^^ ISC001 | ||
47 | | ||
48 | _ = 'a' "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
46 | _ = """a""" "b" | ||
47 | | ||
48 | _ = 'a' "b" | ||
| ^^^^^^^ ISC001 | ||
| | ||
= help: Combine these string literals into one | ||
|
||
|
93 changes: 91 additions & 2 deletions
93
...at/snapshots/ruff__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,109 @@ | ||
--- | ||
source: crates/ruff/src/rules/flake8_implicit_str_concat/mod.rs | ||
--- | ||
ISC.py:1:5: ISC001 Implicitly concatenated string literals on one line | ||
ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
1 | _ = "a" "b" "c" | ||
| ^^^^^^^ ISC001 | ||
2 | | ||
3 | _ = "abc" + "def" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:1:9: ISC001 Implicitly concatenated string literals on one line | ||
ℹ Fix | ||
1 |-_ = "a" "b" "c" | ||
1 |+_ = "ab" "c" | ||
2 2 | | ||
3 3 | _ = "abc" + "def" | ||
4 4 | | ||
|
||
ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
1 | _ = "a" "b" "c" | ||
| ^^^^^^^ ISC001 | ||
2 | | ||
3 | _ = "abc" + "def" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
1 |-_ = "a" "b" "c" | ||
1 |+_ = "a" "bc" | ||
2 2 | | ||
3 3 | _ = "abc" + "def" | ||
4 4 | | ||
|
||
ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
38 | ) | ||
39 | | ||
40 | _ = """a""" """b""" | ||
| ^^^^^^^^^^^^^^^ ISC001 | ||
41 | | ||
42 | _ = f"""a""" f"""b""" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
35 35 | b"def" | ||
36 36 | ) | ||
37 37 | | ||
38 |-_ = """a""" """b""" | ||
38 |+_ = """ab""" | ||
39 39 | | ||
40 40 | _ = f"""a""" f"""b""" | ||
41 41 | | ||
|
||
ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | ||
| | ||
40 | _ = """a""" """b""" | ||
41 | | ||
42 | _ = f"""a""" f"""b""" | ||
| ^^^^^^^^^^^^^^^^^ ISC001 | ||
43 | | ||
44 | _ = f"a" "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ℹ Fix | ||
37 37 | | ||
38 38 | _ = """a""" """b""" | ||
39 39 | | ||
40 |-_ = f"""a""" f"""b""" | ||
40 |+_ = f"""ab""" | ||
41 41 | | ||
42 42 | _ = f"a" "b" | ||
43 43 | | ||
|
||
ISC.py:42:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
42 | _ = f"""a""" f"""b""" | ||
43 | | ||
44 | _ = f"a" "b" | ||
| ^^^^^^^^ ISC001 | ||
45 | | ||
46 | _ = """a""" "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:44:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
44 | _ = f"a" "b" | ||
45 | | ||
46 | _ = """a""" "b" | ||
| ^^^^^^^^^^^ ISC001 | ||
47 | | ||
48 | _ = 'a' "b" | ||
| | ||
= help: Combine these string literals into one | ||
|
||
ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | ||
| | ||
46 | _ = """a""" "b" | ||
47 | | ||
48 | _ = 'a' "b" | ||
| ^^^^^^^ ISC001 | ||
| | ||
= help: Combine these string literals into one | ||
|
||
|