Skip to content
Merged
Changes from 4 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
13 changes: 11 additions & 2 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,17 @@ of the above sections.

.. option:: --strict

This flag mode enables all optional error checking flags. You can see the
list of flags enabled by strict mode in the full :option:`mypy --help` output.
This flag mode enables a defined subset of optional error-checking flags.
This subset primarily includes checks for inadvertent type unsoundness (i.e
strict will catch type errors as long as intentional methods like type ignore
or casting were not used.)

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

If both strict and strict-included flags are set, strict does not take precedence
nor override corresponding flags. You can see the list of flags enabled by strict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be summarized as "all other error-checking flags have precedence over strict, regardless of the order in which they are passed"?
(that's right, right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are right, but I think specifying that only the strict-related flags take precedence makes it clearer because they would be otherwise unrelated/wouldn't override. I have updated it to be:

"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."

Although I was going for clarity, does this still seem too verbose?

mode in the full :option:`mypy --help` output.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think --warn-unreachable deserves explicit mention here as something many (most?) of the users should be interested in enabling separately. It may become part of --strict in future, but isn't now (see #18078)


Note: the exact list of flags enabled by running :option:`--strict` may change
over time.
Expand Down