mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00

## Summary Implements the [redundant-backslash](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes) rule (E502) from pycodestyle. ## Test Plan New fixture has been added Part of #2402
88 lines
622 B
Python
88 lines
622 B
Python
a = 2 + 2
|
|
|
|
a = (2 + 2)
|
|
|
|
a = 2 + \
|
|
3 \
|
|
+ 4
|
|
|
|
a = (3 -\
|
|
2 + \
|
|
7)
|
|
|
|
z = 5 + \
|
|
(3 -\
|
|
2 + \
|
|
7) + \
|
|
4
|
|
|
|
b = [2 +
|
|
2]
|
|
|
|
b = [
|
|
2 + 4 + 5 + \
|
|
44 \
|
|
- 5
|
|
]
|
|
|
|
c = (True and
|
|
False \
|
|
or False \
|
|
and True \
|
|
)
|
|
|
|
c = (True and
|
|
False)
|
|
|
|
d = True and \
|
|
False or \
|
|
False \
|
|
and not True
|
|
|
|
|
|
s = {
|
|
'x': 2 + \
|
|
2
|
|
}
|
|
|
|
|
|
s = {
|
|
'x': 2 +
|
|
2
|
|
}
|
|
|
|
|
|
x = {2 + 4 \
|
|
+ 3}
|
|
|
|
y = (
|
|
2 + 2 # \
|
|
+ 3 # \
|
|
+ 4 \
|
|
+ 3
|
|
)
|
|
|
|
|
|
x = """
|
|
(\\
|
|
)
|
|
"""
|
|
|
|
|
|
("""hello \
|
|
""")
|
|
|
|
("hello \
|
|
")
|
|
|
|
|
|
x = "abc" \
|
|
"xyz"
|
|
|
|
x = ("abc" \
|
|
"xyz")
|
|
|
|
|
|
def foo():
|
|
x = (a + \
|
|
2)
|