This commit is contained in:
Pascal Chambon 2025-12-16 16:40:21 -05:00 committed by GitHub
commit 4d0afa14ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 8 deletions

View File

@ -7,7 +7,7 @@ semantics are the same.
For a complete enumeration of the available configuration options, see [_Settings_](settings.md). For a complete enumeration of the available configuration options, see [_Settings_](settings.md).
If left unspecified, Ruff's default configuration is equivalent to: Ruff's default settings are equivalent to:
=== "pyproject.toml" === "pyproject.toml"
@ -174,7 +174,7 @@ If left unspecified, Ruff's default configuration is equivalent to:
docstring-code-line-length = "dynamic" docstring-code-line-length = "dynamic"
``` ```
As an example, the following would configure Ruff to: As an example, the following file would override some Ruff settings to:
=== "pyproject.toml" === "pyproject.toml"
@ -267,13 +267,15 @@ There are a few exceptions to these rules:
1. If a configuration file is passed directly via `--config`, those settings are used for _all_ 1. If a configuration file is passed directly via `--config`, those settings are used for _all_
analyzed files, and any relative paths in that configuration file (like `exclude` globs or analyzed files, and any relative paths in that configuration file (like `exclude` globs or
`src` paths) are resolved relative to the _current_ working directory. `src` paths) are resolved relative to the _current_ working directory.
1. If no config file is found in the filesystem hierarchy, Ruff will fall back to using 1. If no config file is found in the directory hierarchy, Ruff searches for a user-specific
a default configuration. If a user-specific configuration file exists configuration file at `${config_dir}/ruff/pyproject.toml`, with `${config_dir}` being
at `${config_dir}/ruff/pyproject.toml`, that file will be used instead of the default determined via [`etcetera`'s base strategy](https://docs.rs/etcetera/latest/etcetera/#native-strategy).
configuration, with `${config_dir}` being determined via [`etcetera`'s base strategy](https://docs.rs/etcetera/latest/etcetera/#native-strategy), If such a file exists, it is used and all relative paths are again resolved relative to the
and all relative paths being again resolved relative to the _current working directory_. _current working directory_;
if no configuration file is found at all, Ruff uses its built-in default settings.
1. Any config-file-supported settings that are provided on the command-line (e.g., via 1. Any config-file-supported settings that are provided on the command-line (e.g., via
`--select`) will override the settings in _every_ resolved configuration file. `--select`) will override the settings in _every_ hierarchical configuration context.
Unlike [ESLint](https://eslint.org/docs/latest/use/configure/configuration-files#cascading-configuration-objects), Unlike [ESLint](https://eslint.org/docs/latest/use/configure/configuration-files#cascading-configuration-objects),
Ruff does not merge settings across configuration files; instead, the "closest" configuration file Ruff does not merge settings across configuration files; instead, the "closest" configuration file