Skip to content

Difference between running mypy directly vs with pre-commit run -a #1580

Closed
@nicoddemus

Description

@nicoddemus

Hi,

I'm seeing different output when I execute mypy directly vs running pre-commit run mypy -a. I've tried a few things, including looking at the docs and tweaking the options, but still can't really understand what's happening.

At the root of the repository all code is in Edgar/.

Running mypy:

λ mypy Edgar
... (bunch of mypy errors)
Found 13 errors in 3 files (checked 229 source files)

Running pre-commit run -a mypy:

(.env37) λ pre-commit run -a mypy
mypy.....................................................................Passed

Both commands above were executed from a clean checkout (no modified files).

The docs say -a/--all-files should run the hook against all files in the repository, for that reason I was expecting the same output from both commands.

Here's the mypy configuration in .pre-commit-config.yaml:

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.782
    hooks:
    -   id: mypy
        files: ^Edgar/
        args: []

I'm using pre-commit 2.7.1.

Any idea of what the problem might be @asottile?

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions