From d1e15f6246265dab43bbfbc0f9c10c8a8e720347 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 8 Oct 2024 14:40:22 +0200 Subject: [PATCH] Remove tab-size setting (#12835) Co-authored-by: Alex Waygood Closes https://github.com/astral-sh/ruff/issues/12041 --- crates/ruff/tests/format.rs | 8 +++++++- crates/ruff_workspace/src/configuration.rs | 9 --------- crates/ruff_workspace/src/options.rs | 11 ----------- ruff.schema.json | 12 ------------ 4 files changed, 7 insertions(+), 33 deletions(-) diff --git a/crates/ruff/tests/format.rs b/crates/ruff/tests/format.rs index a70142da54937..e756b03596e63 100644 --- a/crates/ruff/tests/format.rs +++ b/crates/ruff/tests/format.rs @@ -818,7 +818,13 @@ if True: ----- stderr ----- 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 = ` instead. + Cause: Failed to parse [RUFF-TOML-PATH] + Cause: TOML parse error at line 1, column 1 + | + 1 | + | ^ + unknown field `tab-size` + "###); }); Ok(()) diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index b3bd3ee2a373f..d7db3125be574 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -445,15 +445,6 @@ impl Configuration { } }; - #[allow(deprecated)] - 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 = ` instead.")); - } - Ok(Self { builtins: options.builtins, cache_dir: options diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 76f1a4b9a095c..b82cc337f9ad0 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -415,17 +415,6 @@ pub struct Options { )] pub indent_width: Option, - /// The number of spaces a tab is equal to when enforcing long-line violations (like `E501`) - /// or formatting code with the formatter. - /// - /// This option changes the number of spaces inserted by the formatter when - /// using soft-tabs (`indent-style = space`). - #[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 = ` instead." - )] - pub tab_size: Option, - #[option_group] pub lint: Option, diff --git a/ruff.schema.json b/ruff.schema.json index 510c46aa53e63..eb8b422cc038b 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -702,18 +702,6 @@ "type": "string" } }, - "tab-size": { - "description": "The number of spaces a tab is equal to when enforcing long-line violations (like `E501`) or formatting code with the formatter.\n\nThis option changes the number of spaces inserted by the formatter when using soft-tabs (`indent-style = space`).", - "deprecated": true, - "anyOf": [ - { - "$ref": "#/definitions/IndentWidth" - }, - { - "type": "null" - } - ] - }, "target-version": { "description": "The minimum Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations. Ruff will not propose changes using features that are not available in the given version.\n\nFor example, to represent supporting Python >=3.10 or ==3.10 specify `target-version = \"py310\"`.\n\nIf you're already using a `pyproject.toml` file, we recommend `project.requires-python` instead, as it's based on Python packaging standards, and will be respected by other tools. For example, Ruff treats the following as identical to `target-version = \"py38\"`:\n\n```toml [project] requires-python = \">=3.8\" ```\n\nIf both are specified, `target-version` takes precedence over `requires-python`.\n\nNote that a stub file can [sometimes make use of a typing feature](https://typing.readthedocs.io/en/latest/spec/distributing.html#syntax) before it is available at runtime, as long as the stub does not make use of new *syntax*. For example, a type checker will understand `int | str` in a stub as being a `Union` type annotation, even if the type checker is run using Python 3.9, despite the fact that the `|` operator can only be used to create union types at runtime on Python 3.10+. As such, Ruff will often recommend newer features in a stub file than it would for an equivalent runtime file with the same target version.", "anyOf": [