Skip to content

Run the mypy pre-commit only on staged files #80

@julienperichon

Description

@julienperichon

By default, pre-commit gives only the staged files to each pre-commit command.

However, in Sicarator, we do the following:

  - id: type-check
    name: Type checking (mypy)
    entry: make type-check
    pass_filenames: false
    language: system
    types: [python]
    stages: [commit]

with make type-check as

type-check:
	poetry run mypy src

We could do something like this to run mypy only on staged files:

  - id: type-check
    name: Type checking (mypy)
    entry: mypy
    language: system
    types: [python]
    stages: [commit]

@ywolff What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions