Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add warn-unreachable to strict mode #19047

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,6 @@ of the above sections.
strict will catch type errors as long as intentional methods like type ignore
or casting were not used.)

Note: the :option:`--warn-unreachable` flag
is not automatically enabled by the strict flag.

The strict flag does not take precedence over other strict-related flags.
Directly specifying a flag of alternate behavior will override the
behavior of strict, regardless of the order in which they are passed.
Expand Down
2 changes: 1 addition & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def add_invertible_flag(
add_invertible_flag(
"--warn-unreachable",
default=False,
strict_flag=False,
strict_flag=True,
help="Warn about statements or expressions inferred to be unreachable",
group=lint_group,
)
Expand Down
4 changes: 0 additions & 4 deletions mypy_self_check.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ exclude = mypy/typeshed/|mypyc/test-data/|mypyc/lib-rt/
enable_error_code = ignore-without-code,redundant-expr
enable_incomplete_feature = PreciseTupleTypes
show_error_code_links = True

[mypy-mypy.*]
# TODO: enable for `mypyc` and other files as well
warn_unreachable = True
Loading