Remove allow-unused-imports setting from the common lint options (#13677)

Fixes https://github.com/astral-sh/ruff/issues/13668
This commit is contained in:
Micha Reiser 2024-10-08 16:48:31 +02:00 committed by Alex Waygood
parent 1b79ae9817
commit 9218d6bedc
3 changed files with 2 additions and 40 deletions

View file

@ -604,7 +604,6 @@ pub struct LintConfiguration {
pub logger_objects: Option<Vec<String>>,
pub task_tags: Option<Vec<String>>,
pub typing_modules: Option<Vec<String>>,
pub allowed_unused_imports: Option<Vec<String>>,
// Plugins
pub flake8_annotations: Option<Flake8AnnotationsOptions>,
@ -717,7 +716,7 @@ impl LintConfiguration {
task_tags: options.common.task_tags,
logger_objects: options.common.logger_objects,
typing_modules: options.common.typing_modules,
allowed_unused_imports: options.common.allowed_unused_imports,
// Plugins
flake8_annotations: options.common.flake8_annotations,
flake8_bandit: options.common.flake8_bandit,
@ -1086,9 +1085,7 @@ impl LintConfiguration {
.or(config.explicit_preview_rules),
task_tags: self.task_tags.or(config.task_tags),
typing_modules: self.typing_modules.or(config.typing_modules),
allowed_unused_imports: self
.allowed_unused_imports
.or(config.allowed_unused_imports),
// Plugins
flake8_annotations: self.flake8_annotations.combine(config.flake8_annotations),
flake8_bandit: self.flake8_bandit.combine(config.flake8_bandit),
@ -1310,7 +1307,6 @@ fn warn_about_deprecated_top_level_lint_options(
explicit_preview_rules,
task_tags,
typing_modules,
allowed_unused_imports,
unfixable,
flake8_annotations,
flake8_bandit,
@ -1409,9 +1405,6 @@ fn warn_about_deprecated_top_level_lint_options(
if typing_modules.is_some() {
used_options.push("typing-modules");
}
if allowed_unused_imports.is_some() {
used_options.push("allowed-unused-imports");
}
if unfixable.is_some() {
used_options.push("unfixable");

View file

@ -785,16 +785,6 @@ pub struct LintCommonOptions {
)]
pub typing_modules: Option<Vec<String>>,
/// A list of modules which is allowed even though they are not used
/// in the code.
///
/// This is useful when a module has a side effect when imported.
#[option(
default = r#"[]"#,
value_type = "list[str]",
example = r#"allowed-unused-imports = ["hvplot.pandas"]"#
)]
pub allowed_unused_imports: Option<Vec<String>>,
/// A list of rule codes or prefixes to consider non-fixable.
#[option(
default = "[]",

21
ruff.schema.json generated
View file

@ -16,17 +16,6 @@
"minLength": 1
}
},
"allowed-unused-imports": {
"description": "A list of modules which is allowed even though they are not used in the code.\n\nThis is useful when a module has a side effect when imported.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"analyze": {
"description": "Options to configure import map generation.",
"anyOf": [
@ -1886,16 +1875,6 @@
"minLength": 1
}
},
"allowed-unused-imports": {
"description": "A list of modules which is allowed even though they are not used in the code.\n\nThis is useful when a module has a side effect when imported.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"dummy-variable-rgx": {
"description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.",
"type": [