Skip to content

Commit 84259f5

Browse files
Add Applicability to pycodestyle (#5282)
1 parent e8ebe0a commit 84259f5

10 files changed

+23
-27
lines changed

Diff for: crates/ruff/src/rules/pycodestyle/rules/invalid_escape_sequence.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ pub(crate) fn invalid_escape_sequence(
108108
let range = TextRange::at(location, next_char.text_len() + TextSize::from(1));
109109
let mut diagnostic = Diagnostic::new(InvalidEscapeSequence(*next_char), range);
110110
if autofix {
111-
#[allow(deprecated)]
112-
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
111+
diagnostic.set_fix(Fix::automatic(Edit::insertion(
113112
r"\".to_string(),
114113
range.start() + TextSize::from(1),
115114
)));

Diff for: crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ pub(crate) fn missing_whitespace(
9292
let mut diagnostic = Diagnostic::new(kind, token.range());
9393

9494
if autofix {
95-
#[allow(deprecated)]
96-
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
95+
diagnostic.set_fix(Fix::automatic(Edit::insertion(
9796
" ".to_string(),
9897
token.end(),
9998
)));

Diff for: crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_before_parameters.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ pub(crate) fn whitespace_before_parameters(
6565
let mut diagnostic = Diagnostic::new(kind, TextRange::new(start, end));
6666

6767
if autofix {
68-
#[allow(deprecated)]
69-
diagnostic.set_fix(Fix::unspecified(Edit::deletion(start, end)));
68+
diagnostic.set_fix(Fix::automatic(Edit::deletion(start, end)));
7069
}
7170
context.push_diagnostic(diagnostic);
7271
}

Diff for: crates/ruff/src/rules/pycodestyle/rules/missing_newline_at_end_of_file.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ pub(crate) fn no_newline_at_end_of_file(
5555

5656
let mut diagnostic = Diagnostic::new(MissingNewlineAtEndOfFile, range);
5757
if autofix {
58-
#[allow(deprecated)]
59-
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
58+
diagnostic.set_fix(Fix::automatic(Edit::insertion(
6059
stylist.line_ending().to_string(),
6160
range.start(),
6261
)));

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E211_E21.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ E21.py:2:5: E211 [*] Whitespace before '('
1111
|
1212
= help: Removed whitespace before '('
1313

14-
Suggested fix
14+
Fix
1515
1 1 | #: E211
1616
2 |-spam (1)
1717
2 |+spam(1)
@@ -30,7 +30,7 @@ E21.py:4:5: E211 [*] Whitespace before '['
3030
|
3131
= help: Removed whitespace before '['
3232

33-
Suggested fix
33+
Fix
3434
1 1 | #: E211
3535
2 2 | spam (1)
3636
3 3 | #: E211 E211
@@ -51,7 +51,7 @@ E21.py:4:20: E211 [*] Whitespace before '['
5151
|
5252
= help: Removed whitespace before '['
5353

54-
Suggested fix
54+
Fix
5555
1 1 | #: E211
5656
2 2 | spam (1)
5757
3 3 | #: E211 E211
@@ -72,7 +72,7 @@ E21.py:6:12: E211 [*] Whitespace before '['
7272
|
7373
= help: Removed whitespace before '['
7474

75-
Suggested fix
75+
Fix
7676
3 3 | #: E211 E211
7777
4 4 | dict ['key'] = list [index]
7878
5 5 | #: E211

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E231_E23.py.snap

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ E23.py:2:7: E231 [*] Missing whitespace after ','
1111
|
1212
= help: Added missing whitespace after ','
1313

14-
Suggested fix
14+
Fix
1515
1 1 | #: E231
1616
2 |-a = (1,2)
1717
2 |+a = (1, 2)
@@ -30,7 +30,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ','
3030
|
3131
= help: Added missing whitespace after ','
3232

33-
Suggested fix
33+
Fix
3434
1 1 | #: E231
3535
2 2 | a = (1,2)
3636
3 3 | #: E231
@@ -51,7 +51,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':'
5151
|
5252
= help: Added missing whitespace after ':'
5353

54-
Suggested fix
54+
Fix
5555
3 3 | #: E231
5656
4 4 | a[b1,:]
5757
5 5 | #: E231
@@ -71,7 +71,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ','
7171
|
7272
= help: Added missing whitespace after ','
7373

74-
Suggested fix
74+
Fix
7575
16 16 |
7676
17 17 | def foo() -> None:
7777
18 18 | #: E231
@@ -91,7 +91,7 @@ E23.py:29:20: E231 [*] Missing whitespace after ':'
9191
|
9292
= help: Added missing whitespace after ':'
9393

94-
Suggested fix
94+
Fix
9595
26 26 | #: E231:2:20
9696
27 27 | mdtypes_template = {
9797
28 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')],

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W292_W292_0.py.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ W292_0.py:2:9: W292 [*] No newline at end of file
99
|
1010
= help: Add trailing newline
1111

12-
Suggested fix
12+
Fix
1313
1 1 | def fn() -> None:
1414
2 |- pass
1515
2 |+ pass

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_0.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.`
1111
|
1212
= help: Add backslash to escape sequence
1313

14-
Suggested fix
14+
Fix
1515
1 1 | #: W605:1:10
1616
2 |-regex = '\.png$'
1717
2 |+regex = '\\.png$'
@@ -29,7 +29,7 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.`
2929
|
3030
= help: Add backslash to escape sequence
3131

32-
Suggested fix
32+
Fix
3333
3 3 |
3434
4 4 | #: W605:2:1
3535
5 5 | regex = '''
@@ -49,7 +49,7 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_`
4949
|
5050
= help: Add backslash to escape sequence
5151

52-
Suggested fix
52+
Fix
5353
8 8 |
5454
9 9 | #: W605:2:6
5555
10 10 | f(
@@ -70,7 +70,7 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_`
7070
|
7171
= help: Add backslash to escape sequence
7272

73-
Suggested fix
73+
Fix
7474
15 15 | """
7575
16 16 | multi-line
7676
17 17 | literal

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W605_W605_1.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ W605_1.py:2:10: W605 [*] Invalid escape sequence: `\.`
1111
|
1212
= help: Add backslash to escape sequence
1313

14-
Suggested fix
14+
Fix
1515
1 1 | #: W605:1:10
1616
2 |-regex = '\.png$'
1717
2 |+regex = '\\.png$'
@@ -29,7 +29,7 @@ W605_1.py:6:1: W605 [*] Invalid escape sequence: `\.`
2929
|
3030
= help: Add backslash to escape sequence
3131

32-
Suggested fix
32+
Fix
3333
3 3 |
3434
4 4 | #: W605:2:1
3535
5 5 | regex = '''
@@ -49,7 +49,7 @@ W605_1.py:11:6: W605 [*] Invalid escape sequence: `\_`
4949
|
5050
= help: Add backslash to escape sequence
5151

52-
Suggested fix
52+
Fix
5353
8 8 |
5454
9 9 | #: W605:2:6
5555
10 10 | f(
@@ -70,7 +70,7 @@ W605_1.py:18:6: W605 [*] Invalid escape sequence: `\_`
7070
|
7171
= help: Add backslash to escape sequence
7272

73-
Suggested fix
73+
Fix
7474
15 15 | """
7575
16 16 | multi-line
7676
17 17 | literal

Diff for: crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__w292_4.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ W292_4.py:1:2: W292 [*] No newline at end of file
88
|
99
= help: Add trailing newline
1010

11-
Suggested fix
11+
Fix
1212
1 |-
1313
1 |+
1414

0 commit comments

Comments
 (0)