Skip to content
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

Ignore specific error for whole file #11027

Closed
WilliamDEdwards opened this issue Aug 26, 2021 · 1 comment · Fixed by #13512
Closed

Ignore specific error for whole file #11027

WilliamDEdwards opened this issue Aug 26, 2021 · 1 comment · Fixed by #13512
Labels
feature topic-configuration Configuration files and flags topic-type-ignore # type: ignore comments

Comments

@WilliamDEdwards
Copy link

It's possible to either # type: ignore for a whole file or # type: ignore[specific] on a line. A combination of both would be useful.

This script:

def test(input):
	pass

yields:

error: Function is missing a type annotation [no-untyped-def]

This script:

# type: ignore[assignment]

def test(input):
	pass

yields:

Success: no issues found in 1 source file

... while I think it would make more sense for the no-untyped-def error to still be raised, as we're only trying to ignore assignment errors.

@AlexWaygood AlexWaygood added the topic-type-ignore # type: ignore comments label Mar 26, 2022
@WilliamDEdwards
Copy link
Author

Related: #11462

@AlexWaygood AlexWaygood added the topic-configuration Configuration files and flags label Apr 5, 2022
hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Aug 25, 2022
Per-module error codes were added in python#13502, let's recommend using them.

The existing type ignore behaviour is pretty unintuitive; I think most
people actually want `# mypy: ignore-errors`. There are probably people
depending on the current behaviour though.

Fixes python#13435, fixes python#12076, fixes python#11999, fixes python#11027, fixes python#9318,
fixes python#7839
hauntsaninja added a commit that referenced this issue Aug 26, 2022
Per-module error codes were added in #13502, let's recommend using them.

The existing type ignore behaviour is pretty unintuitive; I think most
people actually want `# mypy: ignore-errors`. There are probably people
depending on the current behaviour though.

Fixes #13435, fixes #12076, fixes #11999, fixes #11027, fixes #9318,
fixes #7839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-configuration Configuration files and flags topic-type-ignore # type: ignore comments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants