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

BUG - pre-commit breaks (depending on system) with new pre-commit-config.yaml #34

Open
TjazVracko opened this issue Sep 2, 2024 · 0 comments
Assignees
Labels
type: bug Something is not working and must be fixed.

Comments

@TjazVracko
Copy link
Contributor

TjazVracko commented Sep 2, 2024

Describe the bug

The new pre-commit config specifies v18.1.7˙ of clang-format`.

When installing hooks on a new repo, you get this error:

pre-commit install --install-hooks
pre-commit installed at .git/hooks/pre-commit
Running in migration mode with existing hooks at .git/hooks/commit-msg.legacy
Use -f to use only pre-commit.
pre-commit installed at .git/hooks/commit-msg
An error has occurred: InvalidManifestError:
==> File /home/tjaz/.cache/pre-commit/repo61yo3iqm/.pre-commit-hooks.yaml
==> At Hook(id='clang-format')
==> At key: types_or
==> At index 10
=====> Type tag 'metal' is not recognized.  Try upgrading identify and pre-commit?
Check the log at /home/tjaz/.cache/pre-commit/pre-commit.log

The message is somewhat helpful, it says: Try upgrading identify and pre-commit?
Turns out the "metal" type was only introduced in v2.6 of the identify lib (part of the pre-commit project)

The solution is to run:

pip install pre-commit --upgrade
pip install identify --upgrade

pre-commit itself wrongy specifies identify>=1.0.0, so just updating pre-commit does not pull the required version.


The tooling section of the template readme links to the pre-commit install page, which does not mention the identify lib...

I suggest the tooling section directly specifies the 2 commands:

pip install pre-commit --upgrade
pip install identify --upgrade

@MarkoSagadin Thoughts?

@TjazVracko TjazVracko added the type: bug Something is not working and must be fixed. label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something is not working and must be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants