mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-03 19:56:54 +00:00
Add per-file-ignores mention in violations.rst
There is no mention of "per-file-ignores" option in "Selecting and Ignoring Violations" section documentation, only in "Full Listing of Options and Their Descriptions".
This commit is contained in:
parent
5c52d752e6
commit
74dba5b965
1 changed files with 26 additions and 0 deletions
|
|
@ -136,6 +136,32 @@ the errors in that file will show up without having to modify our
|
|||
configuration. Both exist so we can choose which is better for us.
|
||||
|
||||
|
||||
Ignoring Violations for some Files
|
||||
-----------------------
|
||||
|
||||
Sometimes, we might want to ignore some error codes (or class of error codes) for
|
||||
some part of our project (tests for example).
|
||||
We can do this using :option:`flake8 --per-file-ignores` from CLI:
|
||||
|
||||
.. prompt:: bash
|
||||
|
||||
flake8 --per-file-ignores='project/test.py:F841 setup.py:E121'
|
||||
flake8 --per-file-ignores='tests/*:F841 setup.py:E121'
|
||||
|
||||
We can also specify it in config file:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
per-file-ignores =
|
||||
project/test.py:F841
|
||||
tests/*:F841
|
||||
setup.py:E121
|
||||
other_project/*:W9
|
||||
|
||||
Syntax is similar with :option:`flake8 --exclude` for files
|
||||
and :option:`flake8 --ignore` for errors.
|
||||
|
||||
|
||||
|
||||
Selecting Violations with Flake8
|
||||
================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue