[red-knot] Add --ignore, --warn, and --error CLI arguments (#15689)

This commit is contained in:
Micha Reiser 2025-01-24 16:20:15 +01:00 committed by GitHub
parent ab2e1905c4
commit 4e3982cf95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 396 additions and 83 deletions

View file

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