Add missing config tabs (#8558)

This commit is contained in:
doolio 2023-11-09 02:49:06 +01:00 committed by GitHub
parent 3956f38999
commit 0ea1076f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 15 deletions

View File

@ -208,9 +208,9 @@ Linter plugin configurations are expressed as subsections, e.g.:
docstring-quotes = "double" docstring-quotes = "double"
``` ```
Ruff respects `pyproject.toml`, `ruff.toml`, and `.ruff.toml` files. All three implement Ruff respects `pyproject.toml`, `ruff.toml`, and `.ruff.toml` files. All three implement an
an equivalent schema (though in the `ruff.toml` and `.ruff.toml` versions, the equivalent schema (though in the `ruff.toml` and `.ruff.toml` versions, the `[tool.ruff]` header and
`[tool.ruff]` header is omitted). `tool.ruff` section prefix is omitted).
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).
@ -326,6 +326,8 @@ If you'd prefer to either only lint or only format Jupyter Notebook files, you c
section specific `exclude` option to do so. For example, the following would only lint Jupyter section specific `exclude` option to do so. For example, the following would only lint Jupyter
Notebook files and not format them: Notebook files and not format them:
=== "pyproject.toml"
```toml ```toml
[tool.ruff] [tool.ruff]
extend-include = ["*.ipynb"] extend-include = ["*.ipynb"]
@ -334,8 +336,19 @@ extend-include = ["*.ipynb"]
exclude = ["*.ipynb"] exclude = ["*.ipynb"]
``` ```
=== "ruff.toml"
```toml
extend-include = ["*.ipynb"]
[format]
exclude = ["*.ipynb"]
```
And, conversely, the following would only format Jupyter Notebook files and not lint them: And, conversely, the following would only format Jupyter Notebook files and not lint them:
=== "pyproject.toml"
```toml ```toml
[tool.ruff] [tool.ruff]
extend-include = ["*.ipynb"] extend-include = ["*.ipynb"]
@ -344,6 +357,15 @@ extend-include = ["*.ipynb"]
exclude = ["*.ipynb"] exclude = ["*.ipynb"]
``` ```
=== "ruff.toml"
```toml
extend-include = ["*.ipynb"]
[lint]
exclude = ["*.ipynb"]
```
Alternatively, pass the notebook file(s) to `ruff` on the command-line directly. For example, Alternatively, pass the notebook file(s) to `ruff` on the command-line directly. For example,
`ruff check /path/to/notebook.ipynb` will always lint `notebook.ipynb`. Similarly, `ruff check /path/to/notebook.ipynb` will always lint `notebook.ipynb`. Similarly,
`ruff format /path/to/notebook.ipynb` will always format `notebook.ipynb`. `ruff format /path/to/notebook.ipynb` will always format `notebook.ipynb`.