Skip to content

Commit

Permalink
docs: Add missing toml config tabs (#8512)
Browse files Browse the repository at this point in the history
  • Loading branch information
doolio authored Nov 6, 2023
1 parent 3730137 commit 7f92bfb
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
explicitly set the `src` option in the extended configuration file:
For example, if you add a configuration file to the `tests` directory in the above example, you'll
want to explicitly set the `src` option in the extended configuration file:

```toml
# tests/ruff.toml
extend = "../pyproject.toml"
src = ["../src"]
```
=== "pyproject.toml"

```toml
[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
for a given Python file, and mark imports from within the same package as first-party. For example,
Expand Down Expand Up @@ -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?

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`
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
[tool.ruff]
Expand All @@ -496,7 +505,7 @@ line-length = 88
convention = "google"
```

You could instead use a `ruff.toml` file like so:
=== "ruff.toml"

```toml
line-length = 88
Expand Down

0 comments on commit 7f92bfb

Please sign in to comment.