Skip to content

--strict does not include all mypy checksΒ #14143

Open
@TylerYep

Description

@TylerYep

When configuring mypy, I mistakenly assumed that --strict included all possible mypy checks (thus being as strict as possible). However, there are a lot of other checks that are not included in --strict, such as --warn-unreachable or disallow_any_unimported = True or even enable_error_code = ignore-without-code.

Can we add a section to --strict's documentation and --help page explaining all of mypy's stricter checks that are not included in --strict? As far as I can tell, these are the missing ones:

[mypy]
strict = True

# Missing:
warn_unreachable = True
disallow_any_expr = True
disallow_any_decorated = True
disallow_any_explicit = True
disallow_any_unimported = True

# Not strictness checks per se, but enforces uniformity for type: ignores.
show_error_codes = True
enable_error_code = ignore-without-code

Additionally, it might be useful to add a --strictest flag that always opts into all of mypy's checks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions