mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:24 +00:00
Clarify some docstring-related docs (#4292)
This commit is contained in:
parent
c54e48dce5
commit
43d6aa9173
1 changed files with 5 additions and 2 deletions
|
@ -267,7 +267,7 @@ Found 3 errors.
|
||||||
|
|
||||||
## Does Ruff support NumPy- or Google-style docstrings?
|
## Does Ruff support NumPy- or Google-style docstrings?
|
||||||
|
|
||||||
Yes! To enable specific docstring convention, add the following to your `pyproject.toml`:
|
Yes! To enforce a docstring convention, add the following to your `pyproject.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[tool.ruff.pydocstyle]
|
[tool.ruff.pydocstyle]
|
||||||
|
@ -278,7 +278,8 @@ For example, if you're coming from flake8-docstrings, and your originating confi
|
||||||
`--docstring-convention=numpy`, you'd instead set `convention = "numpy"` in your `pyproject.toml`,
|
`--docstring-convention=numpy`, you'd instead set `convention = "numpy"` in your `pyproject.toml`,
|
||||||
as above.
|
as above.
|
||||||
|
|
||||||
Alongside `convention`, you'll want to explicitly enable the `D` rule code prefix, like so:
|
Alongside `convention`, you'll want to explicitly enable the `D` rule code prefix, since the `D`
|
||||||
|
rules are not enabled by default:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
|
@ -292,6 +293,8 @@ convention = "google"
|
||||||
|
|
||||||
Setting a `convention` force-disables any rules that are incompatible with that convention, no
|
Setting a `convention` force-disables any rules that are incompatible with that convention, no
|
||||||
matter how they're provided, which avoids accidental incompatibilities and simplifies configuration.
|
matter how they're provided, which avoids accidental incompatibilities and simplifies configuration.
|
||||||
|
By default, no `convention` is set, and so the enabled rules are determined by the `select` setting
|
||||||
|
alone.
|
||||||
|
|
||||||
## How can I tell what settings Ruff is using to check my code?
|
## How can I tell what settings Ruff is using to check my code?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue