mirror of https://github.com/astral-sh/ruff
refactor: Get rid of registry::CATEGORIES
This commit is contained in:
parent
04300ce258
commit
c40f14620a
|
|
@ -242,19 +242,6 @@ fn generate_impls<'a>(
|
|||
}
|
||||
});
|
||||
|
||||
let categories = prefix_to_codes.keys().map(|prefix_str| {
|
||||
if prefix_str.chars().all(char::is_alphabetic)
|
||||
&& !PREFIX_REDIRECTS.contains_key(&prefix_str.as_str())
|
||||
{
|
||||
let prefix = Ident::new(prefix_str, Span::call_site());
|
||||
quote! {
|
||||
#prefix_ident::#prefix,
|
||||
}
|
||||
} else {
|
||||
quote! {}
|
||||
}
|
||||
});
|
||||
|
||||
quote! {
|
||||
impl #prefix_ident {
|
||||
pub fn specificity(&self) -> Specificity {
|
||||
|
|
@ -276,7 +263,5 @@ fn generate_impls<'a>(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub const CATEGORIES: &[#prefix_ident] = &[#(#categories)*];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use rustc_hash::FxHashSet;
|
|||
use self::hashable::{HashableGlobMatcher, HashableGlobSet, HashableHashSet, HashableRegex};
|
||||
use self::rule_table::RuleTable;
|
||||
use crate::cache::cache_dir;
|
||||
use crate::registry::{Rule, RuleSelector, Specificity, CATEGORIES, INCOMPATIBLE_CODES};
|
||||
use crate::registry::{Rule, RuleSelector, Specificity, INCOMPATIBLE_CODES};
|
||||
use crate::rules::{
|
||||
flake8_annotations, flake8_bandit, flake8_bugbear, flake8_builtins, flake8_errmsg,
|
||||
flake8_implicit_str_concat, flake8_import_conventions, flake8_pytest_style, flake8_quotes,
|
||||
|
|
@ -240,7 +240,7 @@ impl From<&Configuration> for RuleTable {
|
|||
let mut rules = RuleTable::empty();
|
||||
|
||||
let fixable = resolve_codes([RuleCodeSpec {
|
||||
select: config.fixable.as_deref().unwrap_or(CATEGORIES),
|
||||
select: config.fixable.as_deref().unwrap_or(&[RuleSelector::ALL]),
|
||||
ignore: config.unfixable.as_deref().unwrap_or_default(),
|
||||
}]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue