mcandre / unmake

a makefile linter
Other
84 stars 4 forks source link

Support pre-commit hooks #242

Closed nikosavola closed 3 months ago

nikosavola commented 4 months ago

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.

mcandre commented 3 months ago

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.

ccoVeille commented 3 months ago

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:

ccoVeille commented 3 months ago

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

mcandre commented 3 months ago

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.

ccoVeille commented 2 months ago

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