Skip to content

mypy hook alternating between passing and failing on subsequent runs #1966

Closed

Description

@ssbarnea

I have some doubts that is a pre-commit bug but I am encountering some very weird behaviors from the mypy hook, which makes mypy to alternate between passing or reporting errors on the same codebase. The behavior is clear, after a failure you will get a pass, and a failure if running again.

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
- files were modified by this hook

/Users/ssbarnea/.cache/pre-commit/repo6v6byaj_/py_env-python3.9/lib/python3.9/site-packages/ansiblelint/__init__.py:1: error: Skipping analyzing 'ruamel': found module but no type hints or library stubs
... <similar errors>
Found 138 errors in 138 files (checked 134 source files)

That is happening on MacOS and I suspect some cached files may cause these inconsistency in execution, the even more interesting is the pattern:

  • execution 1: failed
  • execution 2: passed
  • execution 3: failed
  • execution 4: passed

The full configuration can be seen at https://github.com/ansible-community/molecule/blob/master/.pre-commit-config.yaml#L48-L60 but the pattern is very clear: swapping between the two states.

Any idea what could cause this weird behavior? I mention that I did not observe this issue on CI. It may be specific to MacOS?

Activity

  1. asottile commented on Jul 3, 2021

    @asottile
    Member

    files were modified by this hook

    this indicates that you were editing some file while it was running -- the rest is probably a mypy cache bug

    this isn't the right place to report issues with mypy though, please report this to mypy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions