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

Support pre-commit hooks #242

Closed
nikosavola opened this issue Apr 23, 2024 · 5 comments
Closed

Support pre-commit hooks #242

nikosavola opened this issue Apr 23, 2024 · 5 comments

Comments

@nikosavola
Copy link

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
Copy link
Owner

mcandre commented Jun 16, 2024

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
Copy link

ccoVeille commented Jun 16, 2024

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.

@ccoVeille
Copy link

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

@mcandre
Copy link
Owner

mcandre commented Jun 17, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants