Skip to content

Add support for per-module enabling/disabling of error codes #9440

Closed
@hauntsaninja

Description

@hauntsaninja

Feature

#9172 implemented global error code disabling/enabling as discussed in #8975. It seems like it was always the intention to consider per-module configuration (#8975 (comment)), but we don't currently have an open issue for it.

Pitch

My personal use case is for tests. Typing tests is often just a chore, but it's nice to have whatever type safety you can get for free. I'd want to be able to do:

[mypy]
strict = True

[mypy-tests.*]
allow_untyped_defs = True
allow_untyped_calls = True
disable_error_codes = ["var-annotated"]

(For this use case, I think there's actually a fair argument to be made that we should suppress var-annotated aka "needs type annotation" errors when checking untyped defs. If this strikes you as reasonable, I can open another issue. Edit: see #8558 for this)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions