mirror of https://github.com/astral-sh/ruff
Add Applicability to pycodestyle (#5282)
This commit is contained in:
parent
e8ebe0a425
commit
84259f5440
|
|
@ -108,8 +108,7 @@ pub(crate) fn invalid_escape_sequence(
|
|||
let range = TextRange::at(location, next_char.text_len() + TextSize::from(1));
|
||||
let mut diagnostic = Diagnostic::new(InvalidEscapeSequence(*next_char), range);
|
||||
if autofix {
|
||||
#[allow(deprecated)]
|
||||
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
|
||||
diagnostic.set_fix(Fix::automatic(Edit::insertion(
|
||||
r"\".to_string(),
|
||||
range.start() + TextSize::from(1),
|
||||
)));
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ pub(crate) fn missing_whitespace(
|
|||
let mut diagnostic = Diagnostic::new(kind, token.range());
|
||||
|
||||
if autofix {
|
||||
#[allow(deprecated)]
|
||||
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
|
||||
diagnostic.set_fix(Fix::automatic(Edit::insertion(
|
||||
" ".to_string(),
|
||||
token.end(),
|
||||
)));
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ pub(crate) fn whitespace_before_parameters(
|
|||
let mut diagnostic = Diagnostic::new(kind, TextRange::new(start, end));
|
||||
|
||||
if autofix {
|
||||
#[allow(deprecated)]
|
||||
diagnostic.set_fix(Fix::unspecified(Edit::deletion(start, end)));
|
||||
diagnostic.set_fix(Fix::automatic(Edit::deletion(start, end)));
|
||||
}
|
||||
context.push_diagnostic(diagnostic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ pub(crate) fn no_newline_at_end_of_file(
|
|||
|
||||
let mut diagnostic = Diagnostic::new(MissingNewlineAtEndOfFile, range);
|
||||
if autofix {
|
||||
#[allow(deprecated)]
|
||||
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
|
||||
diagnostic.set_fix(Fix::automatic(Edit::insertion(
|
||||
stylist.line_ending().to_string(),
|
||||
range.start(),
|
||||
)));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ E21.py:2:5: E211 [*] Whitespace before '('
|
|||
|
|
||||
= help: Removed whitespace before '('
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: E211
|
||||
2 |-spam (1)
|
||||
2 |+spam(1)
|
||||
|
|
@ -30,7 +30,7 @@ E21.py:4:5: E211 [*] Whitespace before '['
|
|||
|
|
||||
= help: Removed whitespace before '['
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: E211
|
||||
2 2 | spam (1)
|
||||
3 3 | #: E211 E211
|
||||
|
|
@ -51,7 +51,7 @@ E21.py:4:20: E211 [*] Whitespace before '['
|
|||
|
|
||||
= help: Removed whitespace before '['
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: E211
|
||||
2 2 | spam (1)
|
||||
3 3 | #: E211 E211
|
||||
|
|
@ -72,7 +72,7 @@ E21.py:6:12: E211 [*] Whitespace before '['
|
|||
|
|
||||
= help: Removed whitespace before '['
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
3 3 | #: E211 E211
|
||||
4 4 | dict ['key'] = list [index]
|
||||
5 5 | #: E211
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ E23.py:2:7: E231 [*] Missing whitespace after ','
|
|||
|
|
||||
= help: Added missing whitespace after ','
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: E231
|
||||
2 |-a = (1,2)
|
||||
2 |+a = (1, 2)
|
||||
|
|
@ -30,7 +30,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ','
|
|||
|
|
||||
= help: Added missing whitespace after ','
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: E231
|
||||
2 2 | a = (1,2)
|
||||
3 3 | #: E231
|
||||
|
|
@ -51,7 +51,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':'
|
|||
|
|
||||
= help: Added missing whitespace after ':'
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
3 3 | #: E231
|
||||
4 4 | a[b1,:]
|
||||
5 5 | #: E231
|
||||
|
|
@ -71,7 +71,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ','
|
|||
|
|
||||
= help: Added missing whitespace after ','
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
16 16 |
|
||||
17 17 | def foo() -> None:
|
||||
18 18 | #: E231
|
||||
|
|
@ -91,7 +91,7 @@ E23.py:29:20: E231 [*] Missing whitespace after ':'
|
|||
|
|
||||
= help: Added missing whitespace after ':'
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
26 26 | #: E231:2:20
|
||||
27 27 | mdtypes_template = {
|
||||
28 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')],
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ W292_0.py:2:9: W292 [*] No newline at end of file
|
|||
|
|
||||
= help: Add trailing newline
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | def fn() -> None:
|
||||
2 |- pass
|
||||
2 |+ pass
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: W605:1:10
|
||||
2 |-regex = '\.png$'
|
||||
2 |+regex = '\\.png$'
|
||||
|
|
@ -29,7 +29,7 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
3 3 |
|
||||
4 4 | #: W605:2:1
|
||||
5 5 | regex = '''
|
||||
|
|
@ -49,7 +49,7 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
8 8 |
|
||||
9 9 | #: W605:2:6
|
||||
10 10 | f(
|
||||
|
|
@ -70,7 +70,7 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
15 15 | """
|
||||
16 16 | multi-line
|
||||
17 17 | literal
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ W605_1.py:2:10: W605 [*] Invalid escape sequence: `\.`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 1 | #: W605:1:10
|
||||
2 |-regex = '\.png$'
|
||||
2 |+regex = '\\.png$'
|
||||
|
|
@ -29,7 +29,7 @@ W605_1.py:6:1: W605 [*] Invalid escape sequence: `\.`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
3 3 |
|
||||
4 4 | #: W605:2:1
|
||||
5 5 | regex = '''
|
||||
|
|
@ -49,7 +49,7 @@ W605_1.py:11:6: W605 [*] Invalid escape sequence: `\_`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
8 8 |
|
||||
9 9 | #: W605:2:6
|
||||
10 10 | f(
|
||||
|
|
@ -70,7 +70,7 @@ W605_1.py:18:6: W605 [*] Invalid escape sequence: `\_`
|
|||
|
|
||||
= help: Add backslash to escape sequence
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
15 15 | """
|
||||
16 16 | multi-line
|
||||
17 17 | literal
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ W292_4.py:1:2: W292 [*] No newline at end of file
|
|||
|
|
||||
= help: Add trailing newline
|
||||
|
||||
ℹ Suggested fix
|
||||
ℹ Fix
|
||||
1 |-
|
||||
1 |+
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue