Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per-file-ignores mention in violations.rst #1914

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/source/user/violations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------
Paciupa marked this conversation as resolved.
Show resolved Hide resolved

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:
Paciupa marked this conversation as resolved.
Show resolved Hide resolved

.. prompt:: bash

flake8 --per-file-ignores='project/test.py:F841 setup.py:E121'
flake8 --per-file-ignores='tests/*:F841 setup.py:E121'
Paciupa marked this conversation as resolved.
Show resolved Hide resolved

Paciupa marked this conversation as resolved.
Show resolved Hide resolved
We can also specify it in config file:

.. code-block:: ini

per-file-ignores =
project/test.py:F841
tests/*:F841
Paciupa marked this conversation as resolved.
Show resolved Hide resolved
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
================================
Expand Down