mcandre / unmake

a makefile linter

Repository from Github https://github.commcandre/unmakeRepository from Github https://github.commcandre/unmake

Support pre-commit hooks

nikosavola opened this issue · comments

Would be useful to support running the linter through pre-commit hooks, https://pre-commit.com/. I have seen non-Python projects use these so at least this should not be impossible. One example to look at for inspiration may be the Go-based vale.

commented

Indeed, git hooks inherently support every programming language, by delegating from a shell script to the desired program. Any decent linter with semantic exit codes can be triggered this way.

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

I think pre-commit is silly, compared to consuming ordinary provisioning systems and ordinary build systems. It's a wasteful wrapper layer, that manages to break deployment unity within localhost, by requiring that git hooks reimplement build steps outside of the build system.

While I agree with @mcandre about the fact precommit is an extra layer, I would say it's not because you dislike something that you should prevent other from using.

A lot of people use precommit, it's a fact.

It's easy to add a step to their workflow by using it, so they could validate their Makefile by using precommit.

So I would say, it would be better that your project supports it, otherwise someone will create it.

So @nikosavola @mcandre it's up to you.

Either, you are:

  • open to implement it
  • open for contributions, and possibly maintain it slightly (like bumping a version, maybe) once merged
  • don't want it at all, but then home made implementation might pop up, and people might report you bugs about the implementation.

I can help if you are OK for contributions, I did it once. It was pretty easy I think. (Famous last words ™️ 😅)

commented

Obviously I can't stop anyone from making a pre-commit module. I'm just saying that stock git hooks has everything you need to get the job done.

For anyone interested, here is the repository I made to support unmake in pre-commit.

https://github.com/ccoVeille/pre-commit-unmake

I'm looking for testers