Skip to content
Closed
Changes from all commits
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
12 changes: 12 additions & 0 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,18 @@ potentially problematic or redundant in some way.
# Error: 'Statement is unreachable' error
print(x + "bad")

Note that unreachable ``pass`` statements are intentionally not
reported by this option. This allows ``pass`` to be used as a
placeholder during development without triggering an error.

.. code-block:: python

def f(x: int) -> None:
if x > 0:
return
pass # no --warn-unreachable error is reported here


To help prevent mypy from generating spurious warnings, the "Statement is
unreachable" warning will be silenced in exactly two cases:

Expand Down