Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting util.py with pre-commit-hooks' util.py #78

Open
kyoshiro opened this issue Feb 15, 2024 · 0 comments
Open

Conflicting util.py with pre-commit-hooks' util.py #78

kyoshiro opened this issue Feb 15, 2024 · 0 comments

Comments

@kyoshiro
Copy link

Maybe it's my fault in setting up pre-commit-hooks, but I came across a conflict in util.py when using pre-commit-hooks from https://github.com/pre-commit/pre-commit-hooks and this https://github.com/homebysix/pre-commit-macadmin.

check-merge-conflict worked until I added this repo for check-git-config-email hook:

✦ ↳ pre-commit
check for merge conflicts................................................Failed
- hook id: check-merge-conflict
- exit code: 1

Traceback (most recent call last):
  File "/opt/homebrew/bin/check-merge-conflict", line 5, in <module>
    from pre_commit_hooks.check_merge_conflict import main
  File "/Users/kyoshiro/dev/git/myrepo/_build/pip_packages/lib/python3.11/site-packages/pre_commit_hooks/check_merge_conflict.py", line 7, in <module>
    from pre_commit_hooks.util import cmd_output
ImportError: cannot import name 'cmd_output' from 'pre_commit_hooks.util' (/Users/kyoshiro/dev/git/myrepo/_build/pip_packages/lib/python3.11/site-packages/pre_commit_hooks/util.py)

check yaml...............................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Check Git Config Email...................................................Passed
Terraform validate with tflint.......................(no files to check)Skipped
Terraform validate with trivy........................(no files to check)Skipped
prettier.................................................................Passed

My pre-commit-config:

✦ 1 ✗ cat .pre-commit-config.yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: check-merge-conflict
      - id: check-yaml
      - id: end-of-file-fixer
      - id: mixed-line-ending
      - id: trailing-whitespace
  - repo: https://github.com/homebysix/pre-commit-macadmin
    rev: v1.15.0
    hooks:
      - id: check-git-config-email
        args: ["--domains", "example.domain"]
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.86.0
    hooks:
      - id: terraform_tflint
      - id: terraform_trivy
        args:
          - >
            --args=--tf-exclude-downloaded-modules
  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier

It seems, this repo overwrites the util.py of pre-commit-hooks. But maybe I am wrong in setting things up correctly.

To use this repo for check-git-config-email I disabled check-merge-conflict to workaround the issue above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant