mirror of https://github.com/astral-sh/ruff
docs: Add missing toml config tabs (#8512)
This commit is contained in:
parent
37301375c8
commit
7f92bfbc4a
31
docs/faq.md
31
docs/faq.md
|
|
@ -357,14 +357,23 @@ If your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` extends another configura
|
||||||
will still use the directory containing your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file as
|
will still use the directory containing your `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file as
|
||||||
the project root (as opposed to the directory of the file pointed to via the `extends` option).
|
the project root (as opposed to the directory of the file pointed to via the `extends` option).
|
||||||
|
|
||||||
For example, if you add a `ruff.toml` to the `tests` directory in the above example, you'll want to
|
For example, if you add a configuration file to the `tests` directory in the above example, you'll
|
||||||
explicitly set the `src` option in the extended configuration file:
|
want to explicitly set the `src` option in the extended configuration file:
|
||||||
|
|
||||||
```toml
|
=== "pyproject.toml"
|
||||||
# tests/ruff.toml
|
|
||||||
extend = "../pyproject.toml"
|
```toml
|
||||||
src = ["../src"]
|
[tool.ruff]
|
||||||
```
|
extend = "../pyproject.toml"
|
||||||
|
src = ["../src"]
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "ruff.toml"
|
||||||
|
|
||||||
|
```toml
|
||||||
|
extend = "../pyproject.toml"
|
||||||
|
src = ["../src"]
|
||||||
|
```
|
||||||
|
|
||||||
Beyond this `src`-based detection, Ruff will also attempt to determine the current Python package
|
Beyond this `src`-based detection, Ruff will also attempt to determine the current Python package
|
||||||
for a given Python file, and mark imports from within the same package as first-party. For example,
|
for a given Python file, and mark imports from within the same package as first-party. For example,
|
||||||
|
|
@ -482,11 +491,11 @@ Run `ruff check /path/to/code.py --show-settings` to view the resolved settings
|
||||||
|
|
||||||
## I want to use Ruff, but I don't want to use `pyproject.toml`. What are my options?
|
## I want to use Ruff, but I don't want to use `pyproject.toml`. What are my options?
|
||||||
|
|
||||||
Yes! In lieu of a `pyproject.toml` file, you can use a `ruff.toml` file for configuration. The two
|
In lieu of a `pyproject.toml` file, you can use a `ruff.toml` file for configuration. The two
|
||||||
files are functionally equivalent and have an identical schema, with the exception that a `ruff.toml`
|
files are functionally equivalent and have an identical schema, with the exception that a `ruff.toml`
|
||||||
file can omit the `[tool.ruff]` section header.
|
file can omit the `[tool.ruff]` section header. For example:
|
||||||
|
|
||||||
For example, given this `pyproject.toml`:
|
=== "pyproject.toml"
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
|
|
@ -496,7 +505,7 @@ line-length = 88
|
||||||
convention = "google"
|
convention = "google"
|
||||||
```
|
```
|
||||||
|
|
||||||
You could instead use a `ruff.toml` file like so:
|
=== "ruff.toml"
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue