mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-07 09:00:31 +00:00
[red-knot] Add --ignore
, --warn
, and --error
CLI arguments (#15689)
This commit is contained in:
parent
ab2e1905c4
commit
4e3982cf95
9 changed files with 396 additions and 83 deletions
|
@ -163,6 +163,17 @@ fn check_unknown_rule(context: &mut CheckSuppressionsContext) {
|
|||
format_args!("Unknown rule `{rule}`"),
|
||||
);
|
||||
}
|
||||
|
||||
GetLintError::PrefixedWithCategory {
|
||||
prefixed,
|
||||
suggestion,
|
||||
} => {
|
||||
context.report_lint(
|
||||
&UNKNOWN_RULE,
|
||||
unknown.range,
|
||||
format_args!("Unknown rule `{prefixed}`. Did you mean `{suggestion}`?"),
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -765,8 +776,9 @@ impl<'src> SuppressionParser<'src> {
|
|||
|
||||
fn eat_word(&mut self) -> bool {
|
||||
if self.cursor.eat_if(char::is_alphabetic) {
|
||||
// Allow `:` for better error recovery when someone uses `lint:code` instead of just `code`.
|
||||
self.cursor
|
||||
.eat_while(|c| c.is_alphanumeric() || matches!(c, '_' | '-'));
|
||||
.eat_while(|c| c.is_alphanumeric() || matches!(c, '_' | '-' | ':'));
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue