Skip to content

Commit

Permalink
Merge pull request #1681 from wookie184/use-extend-ignore-in-docs
Browse files Browse the repository at this point in the history
Prefer extend-ignore over ignore in general examples
  • Loading branch information
asottile committed Sep 6, 2022
2 parents 4d1a72a + a3e31c2 commit 7a6c42f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ If you only want to see the instances of a specific warning or error, you can
flake8 --select E123,W503 path/to/code/
Alternatively, if you want to *ignore* only one specific warning or error:
Alternatively, if you want to add a specific warning or error to *ignore*:

.. code::
flake8 --ignore E24,W504 path/to/code/
flake8 --extend-ignore E203,W234 path/to/code/
Please read our user guide for more information about how to use and configure
|Flake8|.
Expand Down
12 changes: 6 additions & 6 deletions docs/source/user/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ Let's actually look at |Flake8|'s own configuration section:
.. code-block:: ini
[flake8]
ignore = D203
extend-ignore = E203
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist
max-complexity = 10
This is equivalent to:

.. prompt:: bash

flake8 --ignore D203 \
flake8 --extend-ignore E203 \
--exclude .git,__pycache__,docs/source/conf.py,old,build,dist \
--max-complexity 10

Expand All @@ -107,7 +107,7 @@ In our case, if we wanted to, we could also do
.. code-block:: ini
[flake8]
ignore = D203
extend-ignore = E203
exclude =
.git,
__pycache__,
Expand All @@ -122,7 +122,7 @@ This allows us to add comments for why we're excluding items, e.g.
.. code-block:: ini
[flake8]
ignore = D203
extend-ignore = E203
exclude =
# No need to traverse our git directory
.git,
Expand Down Expand Up @@ -190,15 +190,15 @@ look at a portion of a project's Flake8 configuration in their ``tox.ini``:
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
# H501: Do not use self.__dict__ for string formatting
ignore = H101,H202,H233,H301,H306,H401,H403,H404,H405,H501
extend-ignore = H101,H202,H233,H301,H306,H401,H403,H404,H405,H501
They use the comments to describe the check but they could also write this as:

.. code-block:: ini
[flake8]
# it's not a bug that we aren't using all of hacking
ignore =
extend-ignore =
# H101: Use TODO(NAME)
H101,
# H202: assertRaises Exception too broad
Expand Down

0 comments on commit 7a6c42f

Please sign in to comment.