mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
Remove tab-size setting (#12835)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com> Closes https://github.com/astral-sh/ruff/issues/12041
This commit is contained in:
parent
89a82158a1
commit
d1e15f6246
4 changed files with 7 additions and 33 deletions
|
@ -818,7 +818,13 @@ if True:
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
ruff failed
|
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.
|
Cause: Failed to parse [RUFF-TOML-PATH]
|
||||||
|
Cause: TOML parse error at line 1, column 1
|
||||||
|
|
|
||||||
|
1 |
|
||||||
|
| ^
|
||||||
|
unknown field `tab-size`
|
||||||
|
|
||||||
"###);
|
"###);
|
||||||
});
|
});
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -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 = <value>` instead."));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
builtins: options.builtins,
|
builtins: options.builtins,
|
||||||
cache_dir: options
|
cache_dir: options
|
||||||
|
|
|
@ -415,17 +415,6 @@ pub struct Options {
|
||||||
)]
|
)]
|
||||||
pub indent_width: Option<IndentWidth>,
|
pub indent_width: Option<IndentWidth>,
|
||||||
|
|
||||||
/// 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 = <value>` instead."
|
|
||||||
)]
|
|
||||||
pub tab_size: Option<IndentWidth>,
|
|
||||||
|
|
||||||
#[option_group]
|
#[option_group]
|
||||||
pub lint: Option<LintOptions>,
|
pub lint: Option<LintOptions>,
|
||||||
|
|
||||||
|
|
12
ruff.schema.json
generated
12
ruff.schema.json
generated
|
@ -702,18 +702,6 @@
|
||||||
"type": "string"
|
"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": {
|
"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.",
|
"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": [
|
"anyOf": [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue