diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 10e5d4ebca32..dcd46dcd9aa7 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -21,7 +21,7 @@ flag (or its long form ``--help``):: [--inferstats] [--custom-typing MODULE] [--custom-typeshed-dir DIR] [--scripts-are-modules] [--config-file CONFIG_FILE] [--show-column-numbers] - [--find-occurrences CLASS.MEMBER] [--strict-boolean] + [--find-occurrences CLASS.MEMBER] [--cobertura-xml-report DIR] [--html-report DIR] [--linecount-report DIR] [--linecoverage-report DIR] [--memory-xml-report DIR] [--old-html-report DIR] @@ -366,11 +366,6 @@ Here are some more useful flags: - ``--warn-return-any`` causes mypy to generate a warning when returning a value with type ``Any`` from a function declared with a non- ``Any`` return type. -- ``--strict-boolean`` will make using non-boolean expressions in conditions - an error. This means ``if x`` and ``while x`` are disallowed when ``x`` has any - type other than ``bool``. Instead use explicit checks like ``if x > 0`` or - ``while x is not None``. - - ``--strict`` mode enables all optional error checking flags. You can see the list of flags enabled by strict mode in the full ``mypy -h`` output. diff --git a/docs/source/revision_history.rst b/docs/source/revision_history.rst index d2e2714dff6e..e74386b38476 100644 --- a/docs/source/revision_history.rst +++ b/docs/source/revision_history.rst @@ -3,6 +3,9 @@ Revision history List of major changes to this document: +- April 2017 + * Remove option ``strict_boolean``. + - March 2017 * Publish ``mypy`` version 0.500 on PyPI. diff --git a/mypy/main.py b/mypy/main.py index 2dfd30209ecb..b90d82a30979 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -272,8 +272,6 @@ def add_invertible_flag(flag: str, parser.add_argument('--find-occurrences', metavar='CLASS.MEMBER', dest='special-opts:find_occurrences', help="print out all usages of a class member (experimental)") - add_invertible_flag('--strict-boolean', default=False, strict_flag=True, - help='enable strict boolean checks in conditions') strict_help = "Strict mode. Enables the following flags: {}".format( ", ".join(strict_flag_names)) parser.add_argument('--strict', action='store_true', dest='special-opts:strict', @@ -292,6 +290,8 @@ def add_invertible_flag(flag: str, # --dump-graph will dump the contents of the graph of SCCs and exit. parser.add_argument('--dump-graph', action='store_true', help=argparse.SUPPRESS) # deprecated options + add_invertible_flag('--strict-boolean', default=False, + help=argparse.SUPPRESS) parser.add_argument('-f', '--dirty-stubs', action='store_true', dest='special-opts:dirty_stubs', help=argparse.SUPPRESS) @@ -364,6 +364,9 @@ def add_invertible_flag(flag: str, ) # Process deprecated options + if options.strict_boolean: + print("Warning: --strict-boolean is deprecated; " + "see https://github.com/python/mypy/issues/3195", file=sys.stderr) if special_opts.almost_silent: print("Warning: --almost-silent has been replaced by " "--follow-imports=errors", file=sys.stderr)