Skip to content

Commit

Permalink
Add Applicability to pylint (#5251)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse authored Jun 21, 2023
1 parent 2b76d88 commit f9ffb3d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ pub(crate) fn invalid_string_characters(locator: &Locator, range: TextRange) ->
let location = range.start() + TextSize::try_from(column).unwrap();
let range = TextRange::at(location, c.text_len());

#[allow(deprecated)]
diagnostics.push(Diagnostic::new(rule, range).with_fix(Fix::unspecified(
diagnostics.push(Diagnostic::new(rule, range).with_fix(Fix::automatic(
Edit::range_replacement(replacement.to_string(), range),
)));
}
Expand Down
3 changes: 1 addition & 2 deletions crates/ruff/src/rules/pylint/rules/nested_min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ pub(crate) fn nested_min_max(
keywords: keywords.to_owned(),
range: TextRange::default(),
});
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
checker.generator().expr(&flattened_expr),
expr.range(),
)));
Expand Down
3 changes: 1 addition & 2 deletions crates/ruff/src/rules/pylint/rules/sys_exit_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ pub(crate) fn sys_exit_alias(checker: &mut Checker, func: &Expr) {
checker.semantic(),
)?;
let reference_edit = Edit::range_replacement(binding, func.range());
#[allow(deprecated)]
Ok(Fix::unspecified_edits(import_edit, [reference_edit]))
Ok(Fix::suggested_edits(import_edit, [reference_edit]))
});
}
checker.diagnostics.push(diagnostic);
Expand Down
3 changes: 1 addition & 2 deletions crates/ruff/src/rules/pylint/rules/useless_import_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ pub(crate) fn useless_import_alias(checker: &mut Checker, alias: &Alias) {

let mut diagnostic = Diagnostic::new(UselessImportAlias, alias.range());
if checker.patch(diagnostic.kind.rule()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
asname.to_string(),
alias.range(),
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u
|
= help: Replace with escape sequence

Suggested fix
Fix
12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias,
13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall,
14 14 | #foo = 'hi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ invalid_characters.py:21:12: PLE2512 [*] Invalid unescaped character SUB, use "\
|
= help: Replace with escape sequence

Suggested fix
Fix
18 18 |
19 19 | cr_ok = '\\r'
20 20 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ invalid_characters.py:25:16: PLE2513 [*] Invalid unescaped character ESC, use "\
|
= help: Replace with escape sequence

Suggested fix
Fix
22 22 |
23 23 | sub_ok = '\x1a'
24 24 |
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ invalid_characters.py:34:13: PLE2515 [*] Invalid unescaped character zero-width-
|
= help: Replace with escape sequence

Suggested fix
Fix
31 31 |
32 32 | nul_ok = '\0'
33 33 |
Expand All @@ -32,7 +32,7 @@ invalid_characters.py:38:36: PLE2515 [*] Invalid unescaped character zero-width-
|
= help: Replace with escape sequence

Suggested fix
Fix
35 35 |
36 36 | zwsp_ok = '\u200b'
37 37 |
Expand All @@ -48,7 +48,7 @@ invalid_characters.py:39:60: PLE2515 [*] Invalid unescaped character zero-width-
|
= help: Replace with escape sequence

Suggested fix
Fix
36 36 | zwsp_ok = '\u200b'
37 37 |
38 38 | zwsp_after_multibyte_character = "ಫ​"
Expand All @@ -63,7 +63,7 @@ invalid_characters.py:39:61: PLE2515 [*] Invalid unescaped character zero-width-
|
= help: Replace with escape sequence

Suggested fix
Fix
36 36 | zwsp_ok = '\u200b'
37 37 |
38 38 | zwsp_after_multibyte_character = "ಫ​"
Expand Down

0 comments on commit f9ffb3d

Please sign in to comment.