mrtazz / checkmake

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

Integration as a pre-commit hook #19

Closed Lucas-C closed 7 years ago

Lucas-C commented 7 years ago

Hi.

Some devs at Yelp have written a CLI tool to register & run git pre-commit hooks easily : http://pre-commit.com

I've contributed a few hooks myself in Python, and they just added support for Go hooks: https://github.com/pre-commit/pre-commit/issues/430

Hence I tried to add a checkmake-based hook : https://github.com/Lucas-C/pre-commit-hooks-go

However the fact that it requires a make invocation to build makes it "non standard". At the moment, pre-commit only support go get ./... + the installation of additional dependencies: https://github.com/pre-commit/pre-commit/blob/master/pre_commit/languages/golang.py#L67

Do you think it would be possible to make some changes to the build process of checkmake in order to integrate it as a pre-commit hook ?

There are 2 options I think:

mrtazz commented 7 years ago

This should work now with the caveat mentioned in https://github.com/mrtazz/checkmake/commit/2d3fb76daa99b1ec0817f560a6923521be93e495