mirror of https://github.com/astral-sh/ruff
Use feature instead of test cfg
This commit is contained in:
parent
daa9b4db72
commit
eccda3d3ed
|
|
@ -89,3 +89,5 @@ default = []
|
|||
schemars = ["dep:schemars"]
|
||||
# Enables the UnreachableCode rule
|
||||
unreachable-code = []
|
||||
# Enables rules for internal integration tests
|
||||
test-rules = []
|
||||
|
|
|
|||
|
|
@ -865,11 +865,11 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
|||
(Ruff, "017") => (RuleGroup::Nursery, rules::ruff::rules::QuadraticListSummation),
|
||||
(Ruff, "100") => (RuleGroup::Unspecified, rules::ruff::rules::UnusedNOQA),
|
||||
(Ruff, "200") => (RuleGroup::Unspecified, rules::ruff::rules::InvalidPyprojectToml),
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
(Ruff, "900") => (RuleGroup::Unspecified, rules::ruff::rules::StableTestRule),
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
(Ruff, "901") => (RuleGroup::Nursery, rules::ruff::rules::NurseryTestRule),
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
(Ruff, "902") => (RuleGroup::Preview, rules::ruff::rules::PreviewTestRule),
|
||||
|
||||
// flake8-django
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ pub fn check_path(
|
|||
}
|
||||
|
||||
// Raise violations for internal test rules
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
{
|
||||
if settings.rules.enabled(Rule::StableTestRule) {
|
||||
diagnostics.push(Diagnostic::new(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pub(crate) use mutable_class_default::*;
|
|||
pub(crate) use mutable_dataclass_default::*;
|
||||
pub(crate) use pairwise_over_zipped::*;
|
||||
pub(crate) use static_key_dict_comprehension::*;
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
pub(crate) use test_rules::*;
|
||||
pub(crate) use unnecessary_iterable_allocation_for_first_element::*;
|
||||
#[cfg(feature = "unreachable-code")]
|
||||
|
|
@ -31,7 +31,7 @@ mod mutable_class_default;
|
|||
mod mutable_dataclass_default;
|
||||
mod pairwise_over_zipped;
|
||||
mod static_key_dict_comprehension;
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-rules")]
|
||||
mod test_rules;
|
||||
mod unnecessary_iterable_allocation_for_first_element;
|
||||
#[cfg(feature = "unreachable-code")]
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ walkdir = { version = "2.3.2" }
|
|||
wild = { version = "2" }
|
||||
|
||||
[dev-dependencies]
|
||||
ruff = { path = "../ruff", features = ["clap", "test-rules"] }
|
||||
assert_cmd = { version = "2.0.8" }
|
||||
# Avoid writing colored snapshots when running tests from the terminal
|
||||
colored = { workspace = true, features = ["no-color"]}
|
||||
|
|
|
|||
Loading…
Reference in New Issue