mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-13 16:14:18 +00:00
Apply suggestions from code review
Co-authored-by: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
This commit is contained in:
parent
74dba5b965
commit
aa51e6662b
1 changed files with 14 additions and 8 deletions
|
|
@ -136,25 +136,31 @@ 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.
|
configuration. Both exist so we can choose which is better for us.
|
||||||
|
|
||||||
|
|
||||||
Ignoring Violations for some Files
|
Ignoring Violations in Specific Files
|
||||||
-----------------------
|
-------------------------------------
|
||||||
|
|
||||||
Sometimes, we might want to ignore some error codes (or class of error codes) for
|
If we want to ignore one or more violation codes for certain files, you can
|
||||||
some part of our project (tests for example).
|
use the :option:`flake8 --per-file-ignores` on either the command-line
|
||||||
We can do this using :option:`flake8 --per-file-ignores` from CLI:
|
or in your configuration file.
|
||||||
|
|
||||||
.. prompt:: bash
|
.. prompt:: bash
|
||||||
|
|
||||||
flake8 --per-file-ignores='project/test.py:F841 setup.py:E121'
|
flake8 --per-file-ignores='project/test.py:F841 setup.py:E121'
|
||||||
flake8 --per-file-ignores='tests/*:F841 setup.py:E121'
|
flake8 --per-file-ignores='tests/*:F841,D setup.py:E121'
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
While most options in Flake8 use commas to separate values, this option allows
|
||||||
|
multiple violation codes to be specified per file with commas so to specify
|
||||||
|
multiple file mappings use spaces to delimit them.
|
||||||
|
|
||||||
We can also specify it in config file:
|
We can also specify it in config file:
|
||||||
|
|
||||||
.. code-block:: ini
|
.. code-block:: ini
|
||||||
|
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
project/test.py:F841
|
project/test.py:F841
|
||||||
tests/*:F841
|
tests/*:F841,D
|
||||||
setup.py:E121
|
setup.py:E121
|
||||||
other_project/*:W9
|
other_project/*:W9
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue