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

Skip to content

Update docs on extra_checks flag #18537

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

Merged
merged 2 commits into from
Jan 27, 2025
Merged
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
12 changes: 9 additions & 3 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,8 @@ of the above sections.
.. option:: --extra-checks

This flag enables additional checks that are technically correct but may be
impractical in real code. In particular, it prohibits partial overlap in
``TypedDict`` updates, and makes arguments prepended via ``Concatenate``
positional-only. For example:
impractical. In particular, it prohibits partial overlap in ``TypedDict`` updates,
and makes arguments prepended via ``Concatenate`` positional-only. For example:

.. code-block:: python

Expand All @@ -717,6 +716,13 @@ of the above sections.
bad: Bad = {"a": 0, "b": "no"}
test(bad, bar)

In future more checks may be added to this flag if:

* The corresponding use cases are rare, thus not justifying a dedicated
strictness flag.

* The new check cannot be supported as an opt-in error code.

.. option:: --strict

This flag mode enables all optional error checking flags. You can see the
Expand Down
9 changes: 1 addition & 8 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ section of the command line docs.
:type: boolean
:default: False

This flag enables additional checks that are technically correct but may be impractical in real code.
This flag enables additional checks that are technically correct but may be impractical.
See :option:`mypy --extra-checks` for more info.

.. confval:: implicit_reexport
Expand All @@ -771,13 +771,6 @@ section of the command line docs.
from foo import bar
__all__ = ['bar']

.. confval:: strict_concatenate

:type: boolean
:default: False

Make arguments prepended via ``Concatenate`` be truly positional-only.

.. confval:: strict_equality

:type: boolean
Expand Down
7 changes: 5 additions & 2 deletions docs/source/existing_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ The following config is equivalent to ``--strict`` (as of mypy 1.0):
warn_redundant_casts = True
warn_unused_ignores = True
# Getting these passing should be easy
# Getting this passing should be easy
strict_equality = True
strict_concatenate = True
# Strongly recommend enabling this one as soon as you can
check_untyped_defs = True
Expand All @@ -223,6 +222,10 @@ The following config is equivalent to ``--strict`` (as of mypy 1.0):
# This one can be tricky to get passing if you use a lot of untyped libraries
warn_return_any = True
# This one is a catch-all flag for the rest of strict checks that are technically
# correct but may not be practical
extra_checks = True
Note that you can also start with ``--strict`` and subtract, for instance:

.. code-block:: text
Expand Down
Loading