Skip to content

Replace python-check-blanket-type-ignore with ignore-without-code in mypy#5535

Merged
abn merged 2 commits into
python-poetry:masterfrom
mkniewallner:enable-ignore-without-code-mypy
May 9, 2022
Merged

Replace python-check-blanket-type-ignore with ignore-without-code in mypy#5535
abn merged 2 commits into
python-poetry:masterfrom
mkniewallner:enable-ignore-without-code-mypy

Conversation

@mkniewallner
Copy link
Copy Markdown
Member

@mkniewallner mkniewallner commented May 3, 2022

The repository today relies on python-check-blanket-type-ignore from https://github.com/pre-commit/pygrep-hooks to ensure that all # type: ignore ignore specific error codes.

While this works, version 0.940 of mypy added a way to enforce that through an optional error code (python/mypy#11633).

The main advantage of using this rather than the regex is that the error code indicates the specific error code(s) to ignore in case a too broad # type: ignore is added.
To showcase that, you can see pre-commit output here, extracted from this change based on this PR's branch.

Pull Request Check List

  • Added tests for changed code. Not applicable
  • Updated documentation for changed code. Not applicable

@neersighted neersighted self-assigned this May 8, 2022
The hook is now obsolete, since `ignore-without-code` from `mypy` already checks for too broad `# type: ignore`
@mkniewallner
Copy link
Copy Markdown
Member Author

Force-pushed the branch, since there was a conflict following the merge of #5531.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants