Skip to content

pre-commit hook for mypy fails #1539

Closed
@antti-mikael

Description

@antti-mikael

Description of the problem, including code/CLI snippet

$ git status --short
M  gitlab/v4/objects/container_registry.py
$ git commit
black....................................................................Passed
flake8...................................................................Passed
isort....................................................................Passed
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

gitlab/v4/objects/ldap.py:20: error: Function is missing a type annotation
gitlab/v4/objects/repositories.py:15: error: Function is missing a type annotation
gitlab/v4/objects/repositories.py:38: error: Function is missing a type annotation
...

Maybe the mypy hook could be configured to ignore missing annotations or warn instead of erring -- at least until the annotations are in place:

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 80c8fb8..c69e125 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -24,3 +24,4 @@ repos:
     rev: v0.812
     hooks:
       - id: mypy
+        args: ["--allow-untyped-defs"]

Expected Behavior

I'm able to make commits for files that don't have type annotations.

Actual Behavior

mypy fails for missing function annotations.

Specifications

  • python-gitlab version: master (85713bb)
  • API version you are using (v3/v4): N/A
  • Gitlab server version (or gitlab.com): N/A

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