I am using Ruff, a formatter or linter tool for Python code.
I want to ignore some specific rules, and to write that config in pyproject.toml
.
My package structure is as follows.
.
├── LICENSE
├── pyproject.toml
├── README.md
├── src
│ └── mypackage/mymodule.py
└── tests
├── doc.md
└── test_mymodule.py
And, I want to ignore rules pydocstyle (D) in the tests/
directory.
You can use Ruff's
per-file-ignores
and specify individual files, or select a directory tree with a wildcard (star). You can ignore a "letter class" by specifying only the letter.Example: Ignore specific rule in a specific file
To ignore line-length violations in your tests, add this to pyproject.toml:
Example: Ignore a class of rules in a whole directory tree
To ignore all pydocstyle errors (starting with "D") in your tests, add this to pyproject.toml:
The related Ruff docs are here.