Skip to content

v2.7.1: Global pre-commit hook keeps partial commits intact

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Oct 10:38
· 5 commits to main since this release
Immutable release. Only release title and notes can be modified.
be970a0

hk 2.7.1 fixes the global pre-commit hook adding unstaged changes to commits. It also fixes spurious failures in the Vite+, oxfmt and standard_rb builtins, and makes hk init write a valid identifier for editorconfig-checker.

Fixed

  • Global pre-commit hook now stashes unstaged changes (#1715, @jdx). The hook installed by hk install --global runs hk run pre-commit --from-hook --staged. Because --staged always turned stashing off, the hook ignored its stash setting, including the default stash = "git". If you staged part of a file with git add -p and a fixer then changed that file, the unstaged hunks ended up in the commit. When --staged is used together with --from-hook, hk now follows the hook's stash setting. HK_STASH is ignored in that case, so a global HK_STASH can't override a repository's stash = "none". Running hk run pre-commit --staged yourself still doesn't stash.
  • vp_check, vp_fmt and vp_lint pass when no files match (#1716, @jdx). These Vite+ builtins now pass --no-error-on-unmatched-pattern, as the oxfmt builtin already does. Steps no longer fail when the Vite+ config ignores every staged file, and you don't need custom check/fix overrides for this.
  • oxfmt skips lockfiles (#1717, @jdx). Commits that staged pnpm-lock.yaml or package-lock.json used to print oxfmt failed / Unsupported file type for stdin-filepath. The builtin now excludes both lockfiles from check, check_diff and fix.
  • standard_rb respects .standard.yml exclusions (#1719, @beauraF). Standard ignores exclusions for paths passed to it directly, so hk could report offenses in excluded files. The builtin's check and fix commands now pass --force-exclusion, as the RuboCop builtin already does.
  • hk init writes a valid editorconfig-checker step (#1726, @jdx). hk init --interactive used to write Builtins.editorconfig-checker, which Pkl can't resolve. It now writes ["editorconfig_checker"] = Builtins.editorconfig_checker. The picker now shows this builtin's category and description. hk builtins lists it as editorconfig_checker, the name you use in hk.pkl.

Full Changelog: v2.7.0...v2.7.1

💚 Sponsor hk

hk is built and maintained by @jdx, an open source developer at entire.io, the title sponsor of his open source work.

If hk speeds up your pre-commit loop or makes linting less painful, please consider becoming an individual or company sponsor. Your support funds ongoing development and helps keep hk fast, free, and independent.