Add Applicability to pycodestyle (#5282)

This commit is contained in:
Evan Rittenhouse 2023-06-22 10:25:20 -05:00 committed by GitHub
parent e8ebe0a425
commit 84259f5440
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 27 deletions

View File

@ -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),
)));

View File

@ -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(),
)));

View File

@ -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);
}

View File

@ -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(),
)));

View File

@ -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

View File

@ -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')],

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 |+