add pre-commit-check #1369
Labels
No Label
backups
blog
bootstrapping
bug
changes-requested
cli
documentation
duplicate
enhancement
facts
help wanted
invalid
Inventory
low_prio
manager
modules
needs-review
networking
packaging
question
secrets
template
test
tooling
user-testing
vm
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: clan/clan-core#1369
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fricklerhandwerk/clan-core:add-pre-commit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
make sure things are sane before they hit CI.
this re-purposes the existing treefmt configuration.
Hm, upon further inspection I realized that git-hooks.nix is a Rube Goldberg machine on top of pre-commit, which is a Rube Goldberg machine on top of almost literally running treefmt as a pre-commit hook.
We initially had pre commit checks but found it to break programs like lazygit and be generally too slow. Sometimes you just want to commit a partial unfinished result :-)
@Qubasa hm, I'm developing this on a 2012 Thinkpad and don't even notice the difference.
treefmt
is pretty fast. You can rungit commit --no-verify
to skip the hook.I'd ask to reconsider this, since the overall turnaround is significantly reduced if one doesn't have to wait for and poll CI to notice that there's a formatting error.
Edit: Slowness in the past may have come from the hook running
nix fmt
, which would probably have evaluated some large expression before doing any work. With the proposed setup,treefmt
is run pretty much directly. Check https://github.com/fricklerhandwerk/git-hooks/ for detailed documentation.f6a32f3f04
to02a9390218
02a9390218
to81757051f5
@fricklerhandwerk Ahh I just tested it. It's really fast! Awesome :D