Configuring warnings

For more information, see the Configuring warningssection of the command line docs.

  • warn_redundant_casts (bool, default False)
  • Warns about casting an expression to its inferred type.

This option may only be set in the global section ([mypy]).

  • warn_unused_ignores (bool, default False)
  • Warns about unneeded # type: ignore comments.
  • warn_no_return (bool, default True)
  • Shows errors for missing return statements on some execution paths.
  • warn_return_any (bool, default False)
  • Shows a warning when returning a value with type Any from a functiondeclared with a non- Any return type.
  • warn_unreachable (bool, default False)
  • Shows a warning when encountering any code inferred to be unreachable orredundant after performing type analysis.