Skip to content

Commit

Permalink
Add note about silencing linters (#4314)
Browse files Browse the repository at this point in the history
Fixes #4305.
  • Loading branch information
ethanhs authored and gvanrossum committed Dec 4, 2017
1 parent 0991bc3 commit ec36fe4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/source/common_issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,25 @@ Here's the above example modified to use ``MYPY``:
def listify(arg: 'bar.BarClass') -> 'List[bar.BarClass]':
return [arg]
Silencing Linters
-----------------

In some cases, linters will complain about unused imports or code. In
these cases, you can silence them with a comment after type comments, or on
the same line as the import:

.. code-block:: python
# to silence complaints about unused imports
from typing import List # noqa
a = None # type: List[int]
To silence the linter on the same line as a type comment
put the linter comment *after* the type comment:

.. code-block:: python
a = some_complex_thing() # type: ignore # noqa

0 comments on commit ec36fe4

Please sign in to comment.