mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:22:24 +00:00
Merge Availability and AutofixKind (#3629)
This commit is contained in:
parent
7c0f17279c
commit
fd39ec4bdd
26 changed files with 70 additions and 72 deletions
|
@ -10,7 +10,7 @@ use strum::IntoEnumIterator;
|
|||
|
||||
use ruff::registry::{Linter, Rule, RuleNamespace};
|
||||
use ruff::settings::options::Options;
|
||||
use ruff_diagnostics::Availability;
|
||||
use ruff_diagnostics::AutofixKind;
|
||||
|
||||
use crate::ROOT_DIR;
|
||||
|
||||
|
@ -36,11 +36,9 @@ pub fn main(args: &Args) -> Result<()> {
|
|||
output.push('\n');
|
||||
}
|
||||
|
||||
if let Some(autofix) = rule.autofixable() {
|
||||
output.push_str(match autofix.available {
|
||||
Availability::Sometimes => "Autofix is sometimes available.",
|
||||
Availability::Always => "Autofix is always available.",
|
||||
});
|
||||
let autofix = rule.autofixable();
|
||||
if matches!(autofix, AutofixKind::Always | AutofixKind::Sometimes) {
|
||||
output.push_str(&autofix.to_string());
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use itertools::Itertools;
|
||||
use ruff::registry::{Linter, Rule, RuleNamespace, UpstreamCategory};
|
||||
use ruff_diagnostics::AutofixKind;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
const FIX_SYMBOL: &str = "🛠";
|
||||
|
@ -13,8 +14,8 @@ fn generate_table(table_out: &mut String, rules: impl IntoIterator<Item = Rule>,
|
|||
table_out.push('\n');
|
||||
for rule in rules {
|
||||
let fix_token = match rule.autofixable() {
|
||||
None => "",
|
||||
Some(_) => FIX_SYMBOL,
|
||||
AutofixKind::None => "",
|
||||
AutofixKind::Always | AutofixKind::Sometimes => FIX_SYMBOL,
|
||||
};
|
||||
|
||||
let rule_name = rule.as_ref();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue