Skip to content

feat: pre-commit hook for fmt#595

Merged
vladimirvolek merged 4 commits into
mainfrom
fmt-clippy-precommit
Jun 23, 2026
Merged

feat: pre-commit hook for fmt#595
vladimirvolek merged 4 commits into
mainfrom
fmt-clippy-precommit

Conversation

@vladimirvolek

Copy link
Copy Markdown
Member

No description provided.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blockfrost-platform-docs Ready Ready Preview, Comment Jun 23, 2026 7:06am
blockfrost-platform-docs-next Ready Ready Preview, Comment Jun 23, 2026 7:06am

Request Review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploying blockfrost-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: d90cc41
Status: ✅  Deploy successful!
Preview URL: https://6c65ed56.blockfrost-platform.pages.dev
Branch Preview URL: https://fmt-clippy-precommit.blockfrost-platform.pages.dev

View logs

Comment thread nix/devshells.nix Outdated
startup.install-git-hooks.text = ''
# Point git at our version-controlled hooks (currently: pre-commit fmt check).
if [[ -e "$PRJ_ROOT/.git" ]] ; then
git -C "$PRJ_ROOT" config core.hooksPath .githooks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add || true, in case .git is read-only?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an auto-installed Git pre-commit hook via the Nix devshell so contributors get formatting (treefmt) enforced at commit time.

Changes:

  • Introduces a devshell startup step that configures core.hooksPath for the repo.
  • Adds a generated pre-commit hook that runs the flake formatter with --fail-on-change, with an opt-out via SKIP_TREEFMT.

Comment thread nix/devshells.nix
Comment on lines +183 to +186
if [[ -e "$PRJ_ROOT/.git" ]] ; then
# Don't abort devshell startup if .git is read-only
git -C "$PRJ_ROOT" config --local core.hooksPath ${gitHooks} || true
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it already is equal to gitHooks why would we set it to the same value?

The issue is we want it updated after the /nix/store hash of the gitHooks changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could match /nix/store/*-blockfrost-platform-git-hooks instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d90cc41

@michalrus michalrus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM – I tested it, and it works

Comment thread nix/devshells.nix
Comment on lines +183 to +186
if [[ -e "$PRJ_ROOT/.git" ]] ; then
# Don't abort devshell startup if .git is read-only
git -C "$PRJ_ROOT" config --local core.hooksPath ${gitHooks} || true
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it already is equal to gitHooks why would we set it to the same value?

The issue is we want it updated after the /nix/store hash of the gitHooks changes

Comment thread nix/devshells.nix
Comment on lines +183 to +186
if [[ -e "$PRJ_ROOT/.git" ]] ; then
# Don't abort devshell startup if .git is read-only
git -C "$PRJ_ROOT" config --local core.hooksPath ${gitHooks} || true
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could match /nix/store/*-blockfrost-platform-git-hooks instead.

Comment thread nix/devshells.nix
Comment on lines +183 to +186
if [[ -e "$PRJ_ROOT/.git" ]] ; then
# Don't abort devshell startup if .git is read-only
git -C "$PRJ_ROOT" config --local core.hooksPath ${gitHooks} || true
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d90cc41

@vladimirvolek vladimirvolek merged commit dd5d91d into main Jun 23, 2026
22 of 23 checks passed
@michalrus michalrus added the enhancement New feature or request label Jun 23, 2026
@michalrus michalrus deleted the fmt-clippy-precommit branch June 23, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants