mirror of https://github.com/astral-sh/ruff
Error when using the `tab-size` option (#12006)
This commit is contained in:
parent
36a9efdb48
commit
9e8a45f343
|
|
@ -812,14 +812,13 @@ tab-size = 2
|
|||
if True:
|
||||
pass
|
||||
"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
if True:
|
||||
pass
|
||||
|
||||
----- stderr -----
|
||||
warning: The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update your configuration to use `indent-width = <value>` instead.
|
||||
ruff failed
|
||||
Cause: The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update `[RUFF-TOML-PATH]` to use `indent-width = <value>` instead.
|
||||
"###);
|
||||
});
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -421,13 +421,13 @@ impl Configuration {
|
|||
};
|
||||
|
||||
#[allow(deprecated)]
|
||||
let indent_width = {
|
||||
if options.tab_size.is_some() {
|
||||
warn_user_once!("The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update your configuration to use `indent-width = <value>` instead.");
|
||||
}
|
||||
|
||||
options.indent_width.or(options.tab_size)
|
||||
};
|
||||
if options.tab_size.is_some() {
|
||||
let config_to_update = path.map_or_else(
|
||||
|| String::from("your `--config` CLI arguments"),
|
||||
|path| format!("`{}`", fs::relativize_path(path)),
|
||||
);
|
||||
return Err(anyhow!("The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update {config_to_update} to use `indent-width = <value>` instead."));
|
||||
}
|
||||
|
||||
let output_format = {
|
||||
options
|
||||
|
|
@ -508,7 +508,7 @@ impl Configuration {
|
|||
output_format,
|
||||
force_exclude: options.force_exclude,
|
||||
line_length: options.line_length,
|
||||
indent_width,
|
||||
indent_width: options.indent_width,
|
||||
namespace_packages: options
|
||||
.namespace_packages
|
||||
.map(|namespace_package| resolve_src(&namespace_package, project_root))
|
||||
|
|
|
|||
|
|
@ -402,13 +402,6 @@ pub struct Options {
|
|||
///
|
||||
/// This option changes the number of spaces inserted by the formatter when
|
||||
/// using soft-tabs (`indent-style = space`).
|
||||
#[option(
|
||||
default = "4",
|
||||
value_type = "int",
|
||||
example = r#"
|
||||
tab-size = 2
|
||||
"#
|
||||
)]
|
||||
#[deprecated(
|
||||
since = "0.1.2",
|
||||
note = "The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update your configuration to use `indent-width = <value>` instead."
|
||||
|
|
|
|||
Loading…
Reference in New Issue