Skip to content

Commit

Permalink
πŸ”§ [mypy] Warn about unreachable code (cjolowicz#1025)
Browse files Browse the repository at this point in the history
* πŸ”§ [mypy] Warn about unreachable code

* πŸ”§ [nox] Avoid warning about unreachable code

`nox.Session.bin` is no longer `Optional` in recent versions of Nox.

* πŸ“š Document `mypy --warn-unreachable` in User Guide
  • Loading branch information
cjolowicz authored and cclauss committed Nov 3, 2021
1 parent 671feb0 commit b481ada
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,7 @@ The |HPC| enables several configuration options which are off by default.
The following options are enabled for strictness and enhanced output:

- :option:`strict <mypy --strict>`
- :option:`warn_unreachable <mypy --warn-unreachable>`
- :option:`pretty <mypy --pretty>`
- :option:`show_column_numbers <mypy --show-column-numbers>`
- :option:`show_error_codes <mypy --show-error-codes>`
Expand Down
3 changes: 1 addition & 2 deletions {{cookiecutter.project_name}}/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
Args:
session: The Session object.
"""
if session.bin is None:
return
assert session.bin is not None # noqa: S101

virtualenv = session.env.get("VIRTUAL_ENV")
if virtualenv is None:
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fail_under = 100

[tool.mypy]
strict = true
warn_unreachable = true
pretty = true
show_column_numbers = true
show_error_codes = true
Expand Down

0 comments on commit b481ada

Please sign in to comment.