mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
refactor: Compile time enforcement that all top level lint options are checked for deprecation (#12037)
This commit is contained in:
parent
41203ea208
commit
4b3278fe0b
1 changed files with 93 additions and 48 deletions
|
@ -1218,188 +1218,233 @@ fn warn_about_deprecated_top_level_lint_options(
|
|||
top_level_options: &LintCommonOptions,
|
||||
path: Option<&Path>,
|
||||
) {
|
||||
#[allow(deprecated)]
|
||||
let LintCommonOptions {
|
||||
allowed_confusables,
|
||||
dummy_variable_rgx,
|
||||
extend_ignore,
|
||||
extend_select,
|
||||
extend_fixable,
|
||||
extend_unfixable,
|
||||
external,
|
||||
fixable,
|
||||
ignore,
|
||||
extend_safe_fixes,
|
||||
extend_unsafe_fixes,
|
||||
ignore_init_module_imports,
|
||||
logger_objects,
|
||||
select,
|
||||
explicit_preview_rules,
|
||||
task_tags,
|
||||
typing_modules,
|
||||
unfixable,
|
||||
flake8_annotations,
|
||||
flake8_bandit,
|
||||
flake8_boolean_trap,
|
||||
flake8_bugbear,
|
||||
flake8_builtins,
|
||||
flake8_comprehensions,
|
||||
flake8_copyright,
|
||||
flake8_errmsg,
|
||||
flake8_quotes,
|
||||
flake8_self,
|
||||
flake8_tidy_imports,
|
||||
flake8_type_checking,
|
||||
flake8_gettext,
|
||||
flake8_implicit_str_concat,
|
||||
flake8_import_conventions,
|
||||
flake8_pytest_style,
|
||||
flake8_unused_arguments,
|
||||
isort,
|
||||
mccabe,
|
||||
pep8_naming,
|
||||
pycodestyle,
|
||||
pydocstyle,
|
||||
pyflakes,
|
||||
pylint,
|
||||
pyupgrade,
|
||||
per_file_ignores,
|
||||
extend_per_file_ignores,
|
||||
} = top_level_options;
|
||||
let mut used_options = Vec::new();
|
||||
|
||||
if top_level_options.allowed_confusables.is_some() {
|
||||
if allowed_confusables.is_some() {
|
||||
used_options.push("allowed-confusables");
|
||||
}
|
||||
|
||||
if top_level_options.dummy_variable_rgx.is_some() {
|
||||
if dummy_variable_rgx.is_some() {
|
||||
used_options.push("dummy-variable-rgx");
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
if top_level_options.extend_ignore.is_some() {
|
||||
if extend_ignore.is_some() {
|
||||
used_options.push("extend-ignore");
|
||||
}
|
||||
|
||||
if top_level_options.extend_select.is_some() {
|
||||
if extend_select.is_some() {
|
||||
used_options.push("extend-select");
|
||||
}
|
||||
|
||||
if top_level_options.extend_fixable.is_some() {
|
||||
if extend_fixable.is_some() {
|
||||
used_options.push("extend-fixable");
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
if top_level_options.extend_unfixable.is_some() {
|
||||
if extend_unfixable.is_some() {
|
||||
used_options.push("extend-unfixable");
|
||||
}
|
||||
|
||||
if top_level_options.external.is_some() {
|
||||
if external.is_some() {
|
||||
used_options.push("external");
|
||||
}
|
||||
|
||||
if top_level_options.fixable.is_some() {
|
||||
if fixable.is_some() {
|
||||
used_options.push("fixable");
|
||||
}
|
||||
|
||||
if top_level_options.ignore.is_some() {
|
||||
if ignore.is_some() {
|
||||
used_options.push("ignore");
|
||||
}
|
||||
|
||||
if top_level_options.extend_safe_fixes.is_some() {
|
||||
if extend_safe_fixes.is_some() {
|
||||
used_options.push("extend-safe-fixes");
|
||||
}
|
||||
|
||||
if top_level_options.extend_unsafe_fixes.is_some() {
|
||||
if extend_unsafe_fixes.is_some() {
|
||||
used_options.push("extend-unsafe-fixes");
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
if top_level_options.ignore_init_module_imports.is_some() {
|
||||
if ignore_init_module_imports.is_some() {
|
||||
used_options.push("ignore-init-module-imports");
|
||||
}
|
||||
|
||||
if top_level_options.logger_objects.is_some() {
|
||||
if logger_objects.is_some() {
|
||||
used_options.push("logger-objects");
|
||||
}
|
||||
|
||||
if top_level_options.select.is_some() {
|
||||
if select.is_some() {
|
||||
used_options.push("select");
|
||||
}
|
||||
|
||||
if top_level_options.explicit_preview_rules.is_some() {
|
||||
if explicit_preview_rules.is_some() {
|
||||
used_options.push("explicit-preview-rules");
|
||||
}
|
||||
|
||||
if top_level_options.task_tags.is_some() {
|
||||
if task_tags.is_some() {
|
||||
used_options.push("task-tags");
|
||||
}
|
||||
|
||||
if top_level_options.typing_modules.is_some() {
|
||||
if typing_modules.is_some() {
|
||||
used_options.push("typing-modules");
|
||||
}
|
||||
|
||||
if top_level_options.unfixable.is_some() {
|
||||
if unfixable.is_some() {
|
||||
used_options.push("unfixable");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_annotations.is_some() {
|
||||
if flake8_annotations.is_some() {
|
||||
used_options.push("flake8-annotations");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_bandit.is_some() {
|
||||
if flake8_bandit.is_some() {
|
||||
used_options.push("flake8-bandit");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_boolean_trap.is_some() {
|
||||
if flake8_boolean_trap.is_some() {
|
||||
used_options.push("flake8-boolean-trap");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_bugbear.is_some() {
|
||||
if flake8_bugbear.is_some() {
|
||||
used_options.push("flake8-bugbear");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_builtins.is_some() {
|
||||
if flake8_builtins.is_some() {
|
||||
used_options.push("flake8-builtins");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_comprehensions.is_some() {
|
||||
if flake8_comprehensions.is_some() {
|
||||
used_options.push("flake8-comprehensions");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_copyright.is_some() {
|
||||
if flake8_copyright.is_some() {
|
||||
used_options.push("flake8-copyright");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_errmsg.is_some() {
|
||||
if flake8_errmsg.is_some() {
|
||||
used_options.push("flake8-errmsg");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_quotes.is_some() {
|
||||
if flake8_quotes.is_some() {
|
||||
used_options.push("flake8-quotes");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_self.is_some() {
|
||||
if flake8_self.is_some() {
|
||||
used_options.push("flake8-self");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_tidy_imports.is_some() {
|
||||
if flake8_tidy_imports.is_some() {
|
||||
used_options.push("flake8-tidy-imports");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_type_checking.is_some() {
|
||||
if flake8_type_checking.is_some() {
|
||||
used_options.push("flake8-type-checking");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_gettext.is_some() {
|
||||
if flake8_gettext.is_some() {
|
||||
used_options.push("flake8-gettext");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_implicit_str_concat.is_some() {
|
||||
if flake8_implicit_str_concat.is_some() {
|
||||
used_options.push("flake8-implicit-str-concat");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_import_conventions.is_some() {
|
||||
if flake8_import_conventions.is_some() {
|
||||
used_options.push("flake8-import-conventions");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_pytest_style.is_some() {
|
||||
if flake8_pytest_style.is_some() {
|
||||
used_options.push("flake8-pytest-style");
|
||||
}
|
||||
|
||||
if top_level_options.flake8_unused_arguments.is_some() {
|
||||
if flake8_unused_arguments.is_some() {
|
||||
used_options.push("flake8-unused-arguments");
|
||||
}
|
||||
|
||||
if top_level_options.isort.is_some() {
|
||||
if isort.is_some() {
|
||||
used_options.push("isort");
|
||||
}
|
||||
|
||||
if top_level_options.mccabe.is_some() {
|
||||
if mccabe.is_some() {
|
||||
used_options.push("mccabe");
|
||||
}
|
||||
|
||||
if top_level_options.pep8_naming.is_some() {
|
||||
if pep8_naming.is_some() {
|
||||
used_options.push("pep8-naming");
|
||||
}
|
||||
|
||||
if top_level_options.pycodestyle.is_some() {
|
||||
if pycodestyle.is_some() {
|
||||
used_options.push("pycodestyle");
|
||||
}
|
||||
|
||||
if top_level_options.pydocstyle.is_some() {
|
||||
if pydocstyle.is_some() {
|
||||
used_options.push("pydocstyle");
|
||||
}
|
||||
|
||||
if top_level_options.pyflakes.is_some() {
|
||||
if pyflakes.is_some() {
|
||||
used_options.push("pyflakes");
|
||||
}
|
||||
|
||||
if top_level_options.pylint.is_some() {
|
||||
if pylint.is_some() {
|
||||
used_options.push("pylint");
|
||||
}
|
||||
|
||||
if top_level_options.pyupgrade.is_some() {
|
||||
if pyupgrade.is_some() {
|
||||
used_options.push("pyupgrade");
|
||||
}
|
||||
|
||||
if top_level_options.per_file_ignores.is_some() {
|
||||
if per_file_ignores.is_some() {
|
||||
used_options.push("per-file-ignores");
|
||||
}
|
||||
|
||||
if top_level_options.extend_per_file_ignores.is_some() {
|
||||
if extend_per_file_ignores.is_some() {
|
||||
used_options.push("extend-per-file-ignores");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue