mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:35 +00:00
Add Applicability to pylint (#5251)
This commit is contained in:
parent
2b76d88bd3
commit
f9ffb3d50d
9 changed files with 11 additions and 15 deletions
|
@ -191,8 +191,7 @@ pub(crate) fn invalid_string_characters(locator: &Locator, range: TextRange) ->
|
||||||
let location = range.start() + TextSize::try_from(column).unwrap();
|
let location = range.start() + TextSize::try_from(column).unwrap();
|
||||||
let range = TextRange::at(location, c.text_len());
|
let range = TextRange::at(location, c.text_len());
|
||||||
|
|
||||||
#[allow(deprecated)]
|
diagnostics.push(Diagnostic::new(rule, range).with_fix(Fix::automatic(
|
||||||
diagnostics.push(Diagnostic::new(rule, range).with_fix(Fix::unspecified(
|
|
||||||
Edit::range_replacement(replacement.to_string(), range),
|
Edit::range_replacement(replacement.to_string(), range),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,8 +157,7 @@ pub(crate) fn nested_min_max(
|
||||||
keywords: keywords.to_owned(),
|
keywords: keywords.to_owned(),
|
||||||
range: TextRange::default(),
|
range: TextRange::default(),
|
||||||
});
|
});
|
||||||
#[allow(deprecated)]
|
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
|
||||||
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
|
|
||||||
checker.generator().expr(&flattened_expr),
|
checker.generator().expr(&flattened_expr),
|
||||||
expr.range(),
|
expr.range(),
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -82,8 +82,7 @@ pub(crate) fn sys_exit_alias(checker: &mut Checker, func: &Expr) {
|
||||||
checker.semantic(),
|
checker.semantic(),
|
||||||
)?;
|
)?;
|
||||||
let reference_edit = Edit::range_replacement(binding, func.range());
|
let reference_edit = Edit::range_replacement(binding, func.range());
|
||||||
#[allow(deprecated)]
|
Ok(Fix::suggested_edits(import_edit, [reference_edit]))
|
||||||
Ok(Fix::unspecified_edits(import_edit, [reference_edit]))
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checker.diagnostics.push(diagnostic);
|
checker.diagnostics.push(diagnostic);
|
||||||
|
|
|
@ -49,8 +49,7 @@ pub(crate) fn useless_import_alias(checker: &mut Checker, alias: &Alias) {
|
||||||
|
|
||||||
let mut diagnostic = Diagnostic::new(UselessImportAlias, alias.range());
|
let mut diagnostic = Diagnostic::new(UselessImportAlias, alias.range());
|
||||||
if checker.patch(diagnostic.kind.rule()) {
|
if checker.patch(diagnostic.kind.rule()) {
|
||||||
#[allow(deprecated)]
|
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
|
||||||
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
|
|
||||||
asname.to_string(),
|
asname.to_string(),
|
||||||
alias.range(),
|
alias.range(),
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -12,7 +12,7 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias,
|
12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias,
|
||||||
13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall,
|
13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall,
|
||||||
14 14 | #foo = 'hi'
|
14 14 | #foo = 'hi'
|
||||||
|
|
|
@ -12,7 +12,7 @@ invalid_characters.py:21:12: PLE2512 [*] Invalid unescaped character SUB, use "\
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
18 18 |
|
18 18 |
|
||||||
19 19 | cr_ok = '\\r'
|
19 19 | cr_ok = '\\r'
|
||||||
20 20 |
|
20 20 |
|
||||||
|
|
|
@ -12,7 +12,7 @@ invalid_characters.py:25:16: PLE2513 [*] Invalid unescaped character ESC, use "\
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
22 22 |
|
22 22 |
|
||||||
23 23 | sub_ok = '\x1a'
|
23 23 | sub_ok = '\x1a'
|
||||||
24 24 |
|
24 24 |
|
||||||
|
|
Binary file not shown.
|
@ -12,7 +12,7 @@ invalid_characters.py:34:13: PLE2515 [*] Invalid unescaped character zero-width-
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
31 31 |
|
31 31 |
|
||||||
32 32 | nul_ok = '\0'
|
32 32 | nul_ok = '\0'
|
||||||
33 33 |
|
33 33 |
|
||||||
|
@ -32,7 +32,7 @@ invalid_characters.py:38:36: PLE2515 [*] Invalid unescaped character zero-width-
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
35 35 |
|
35 35 |
|
||||||
36 36 | zwsp_ok = '\u200b'
|
36 36 | zwsp_ok = '\u200b'
|
||||||
37 37 |
|
37 37 |
|
||||||
|
@ -48,7 +48,7 @@ invalid_characters.py:39:60: PLE2515 [*] Invalid unescaped character zero-width-
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
36 36 | zwsp_ok = '\u200b'
|
36 36 | zwsp_ok = '\u200b'
|
||||||
37 37 |
|
37 37 |
|
||||||
38 38 | zwsp_after_multibyte_character = "ಫ"
|
38 38 | zwsp_after_multibyte_character = "ಫ"
|
||||||
|
@ -63,7 +63,7 @@ invalid_characters.py:39:61: PLE2515 [*] Invalid unescaped character zero-width-
|
||||||
|
|
|
|
||||||
= help: Replace with escape sequence
|
= help: Replace with escape sequence
|
||||||
|
|
||||||
ℹ Suggested fix
|
ℹ Fix
|
||||||
36 36 | zwsp_ok = '\u200b'
|
36 36 | zwsp_ok = '\u200b'
|
||||||
37 37 |
|
37 37 |
|
||||||
38 38 | zwsp_after_multibyte_character = "ಫ"
|
38 38 | zwsp_after_multibyte_character = "ಫ"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue