mrtazz / checkmake

experimental linter/analyzer for Makefiles
MIT License
1.03k stars 45 forks source link

Pre-commit based Installation fails - pathspec '0.2.2' did not match and others #80

Closed michael-delarue-axomic closed 1 year ago

michael-delarue-axomic commented 1 year ago

Expected behaviour

Adding checkmake to the pre-commit file should install checkmake and work

Actual behaviour - version 0.2.2

  -   repo: https://github.com/mrtazz/checkmake.git
      rev: 0.2.2
      hooks:
      -   id: checkmake

run pre-commit run -a outputs

$ pre-commit run -a
[INFO] Initializing environment for https://github.com/mrtazz/checkmake.git.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', '0.2.2')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    error: pathspec '0.2.2' did not match any file(s) known to git

Check the log at /home/mdd/.cache/pre-commit/pre-commit.log

Actual behaviour - version 0.2.1

  -   repo: https://github.com/mrtazz/checkmake.git
      rev: 0.2.2
      hooks:
      -   id: checkmake

run pre-commit run -a outputs

$ pre-commit run -a
[INFO] Initializing environment for https://github.com/mrtazz/checkmake.git.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', '0.2.2')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    error: pathspec '0.2.2' did not match any file(s) known to git

Check the log at /home/mdd/.cache/pre-commit/pre-commit.log

Actual behaviour - version 0.2.1

  -   repo: https://github.com/mrtazz/checkmake.git
      rev: 0.2.1
      hooks:
      -   id: checkmake

run pre-commit run -a outputs

$ pre-commit run -a
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/pycqa/flake8.
[INFO] Initializing environment for https://github.com/mrtazz/checkmake.git.
An error has occurred: InvalidManifestError: 
=====> /home/mdd/.cache/pre-commit/reposdl9a_i5/.pre-commit-hooks.yaml is not a file
Check the log at /home/mdd/.cache/pre-commit/pre-commit.log

Output of checkmake --version

n/a - not installed locally

Output of checkmake --debug <your makefile>

n/a - not installed locally

Output of make --version

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Licence GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Sample Makefile to reproduce issue

n/a - no Makefile needed.

michael-delarue-axomic commented 1 year ago

BTW; I have the weird situation that in one repo using the code below seems to solve it but not in the other

  - repo: https://github.com/trinitronx/checkmake/
    rev: 0.2.2
    hooks:
      - id: checkmake
        files: Makefile

N.B. This is not the main mrtazz repo

Ping @trinitronx

michael-delarue-axomic commented 1 year ago

I have proposed a very simple fix for checkmake which appears to fix these problems for me.

If I run with

  - repo: https://github.com/michael-delarue-axomic/checkmake.git
    rev: 4c3809bc541f45e7793d37ce06f67496123f8e23
    hooks:
    - id: checkmake
      files: Makefile

Then checkmake is working for me. If anyone's following and has the same problems, please report in this ticket or on the PR if this fixes them for you.

colindean commented 1 year ago

Your suggested hash for rev is correct. When https://github.com/mrtazz/checkmake/pull/69 added the pre-commit config to the README, I think we anticipated @mrtazz releasing 0.2.2 shortly thereafter but it has not yet come to pass.

mrtazz commented 1 year ago

There is now a v0.2.2 release https://github.com/mrtazz/checkmake/releases/tag/0.2.2