when use pre-commit, mypy check passed but print mypy syntax error

Viewed 1001

I use pre-commit to run mypy type check, and when mypy check passed it print string error logs like this.

/username/.cache/pre-commit/repo61b8m7wl/py_env-python3.9/lib/python3.9/site-packages/mypy/typeshed/stdlib/2and3/builtins.pyi:33: error: syntax error in type comment

this is very annoying because similar logs printed like 20 lines or 30 lines and it is not even related to code that I wrote. How can I disable this?

this is my pre-commit config file.

repos:
  
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.720
    hooks:
     - id: mypy
       verbose: true
       entry: bash -c 'mypy "$@" || true' --
2 Answers

|| true ignores any error from mypy. Remove it:

   entry: bash -c 'mypy "$@"' --

or simply

   entry: mypy

The accepted answer didn't work for me. To fix the problem, I used a different rev:

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: 'v0.910'
    hooks:
      - id: mypy
Related