-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add --pre-commit mode #78
Comments
I've ended up using repos:
- repo: local
hooks:
- id: treefmt
name: treefmt
entry: treefmt
language: system
always_run: true Seems to work well! |
What behaviour does it have if the commit is not fully formatted? Is it updating the commit with the fixed code, or aborting with an error? |
It formats the code, and then because files have changed |
A - id: treefmt
name: treefmt
description: Format code with treefmt
entry: treefmt
language: rust
minimum_pre_commit_version: 1.18.1 so that repos:
- repo: https://github.com/numtide/treefmt
rev: master
hooks:
- id: treefmt |
This is working towards #78 . In the end that script would be shipped with the treefmt binary, but for now let's just test it out.
The pre-commit framework is a bit heavy for my taste so I wrote a bash script to replace it (see #166). I think both approaches are valid, depending on if you use nix to pull the dependencies or not. If you don't then it's nice to have all the machinery that's provided by the pre-commit python code. |
This is working towards #78 . In the end that script would be shipped with the treefmt binary, but for now let's just test it out.
This is working towards numtide#78 . In the end that script would be shipped with the treefmt binary, but for now let's just test it out.
This is now being tracked here #311 |
Some developers like to invoke the formatters just before committing the code.
When invoked, it should only format the code that has been staged for the commit and not touch the rest.
This can be done like this: https://stackoverflow.com/a/26911078
And also probably check for unresolved merge commits before and abort if that's the case.
The text was updated successfully, but these errors were encountered: