mirror of
https://github.com/astral-sh/ty.git
synced 2025-12-23 05:36:53 +00:00
Use pyproject.toml title in relevant configuration snippets (#1904)
This commit is contained in:
parent
e67a51fad7
commit
1b92a453ea
4 changed files with 6 additions and 10 deletions
|
|
@ -8,9 +8,7 @@ Specifically, ty will search for a `pyproject.toml` or `ty.toml` file in the cur
|
|||
|
||||
If a `pyproject.toml` file is found, ty will read configuration from the `[tool.ty]` table. For example, to ignore the `index-out-of-bounds` rule, add the following to a `pyproject.toml`:
|
||||
|
||||
**`pyproject.toml`**:
|
||||
|
||||
```toml
|
||||
```toml title="pyproject.toml"
|
||||
[tool.ty.rules]
|
||||
index-out-of-bounds = "ignore"
|
||||
```
|
||||
|
|
@ -19,9 +17,7 @@ index-out-of-bounds = "ignore"
|
|||
|
||||
ty will also search for `ty.toml` files, which follow an identical structure, but omit the `[tool.ty]` prefix. For example:
|
||||
|
||||
**`ty.toml`**:
|
||||
|
||||
```toml
|
||||
```toml title="ty.toml"
|
||||
[rules]
|
||||
index-out-of-bounds = "ignore"
|
||||
```
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ ty automatically discovers all Python files in your project. You can customize w
|
|||
|
||||
For example, with the following configuration, ty checks all Python files in the `src` and `tests` directories except those in the `src/generated` directory:
|
||||
|
||||
```toml
|
||||
```toml title="pyproject.toml"
|
||||
[tool.ty.src]
|
||||
include = ["src", "tests"]
|
||||
exclude = ["src/generated"]
|
||||
|
|
@ -14,7 +14,7 @@ exclude = ["src/generated"]
|
|||
|
||||
By default, ty excludes a [variety of commonly ignored directories](./reference/configuration.md#exclude). If you want to include one of these directories, you can do so by adding a negative `exclude`:
|
||||
|
||||
```toml
|
||||
```toml title="pyproject.toml"
|
||||
[tool.ty.src]
|
||||
# Remove `build` from the excluded directories.
|
||||
exclude = ["!**/build/"]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ example-pkg
|
|||
|
||||
then set [`environment.root`](./reference/configuration.md#root) in your `pyproject.toml` to `["./app"]`:
|
||||
|
||||
```toml
|
||||
```toml title="pyproject.toml"
|
||||
[tool.ty.environment]
|
||||
root = ["./app"]
|
||||
```
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ Rule levels can also be changed in the [`rules`](./reference/configuration.md#ru
|
|||
|
||||
For example, the following is equivalent to the command above:
|
||||
|
||||
```toml
|
||||
```toml title="pyproject.toml"
|
||||
[tool.ty.rules]
|
||||
unused-ignore-comment = "warn"
|
||||
redundant-cast = "ignore"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue