github jdx/hk v2.8.2
v2.8.2: Resolve check file arguments from the current directory

latest release: v2.9.0
3 hours ago

hk 2.8.2 makes hk check <file> resolve paths from the directory you run it in, and stops hk processes that start at the same time from reading half-written config cache files. cargo install hk builds now include the Pkl package, so offline mode works with them, and hk install --global reports the git config file it actually wrote to.

Fixed

  • File arguments are resolved from the directory hk was run in (#1754, @jdx). hk changes to the repository root before it runs, so relative file arguments used to be resolved from the root. Running hk check a.js inside sub/ checked <root>/a.js instead of sub/a.js. Paths given as arguments or through --files0-from are now resolved from where you ran hk. Absolute paths and paths outside the repository still work. Fixes #1753.

    $ cd sub
    $ hk check a.js      # checks sub/a.js (previously <root>/a.js)
    $ hk check ../a.js   # checks a.js at the repository root
    $ hk check .         # checks sub/
  • No more cache parse warnings when hk processes start at the same time (#1750, @zachbornheimer). Several hk processes can start together, for example a pre-commit and a pre-push hook, or agents running in parallel. When that happened, one process could read a config cache entry another was still writing. It then printed failed to parse cache file ...: EOF while parsing a value and evaluated the config again. hk now writes each cache entry to a temporary file and renames it into place, so readers always get a complete entry. A replaced entry keeps its Unix file mode. If a write fails, the error names the entry.

  • cargo install hk builds can run offline (#1755, @jdx). The crate on crates.io was published without the generated Pkl builtins, so builds from it embedded an empty Pkl package. With HK_PKL_OFFLINE=1, they failed with package is not cached and offline mode is enabled, even when hk.pkl pinned the installed version. The publish step now generates the package and fails if it is missing. Starting with this release, cargo install hk embeds the package just like the prebuilt release binaries do.

  • hk install --global names the git config file it wrote to (#1758, @sahidvelji). Git writes global settings to ~/.config/git/config when ~/.gitconfig doesn't exist, or to $GIT_CONFIG_GLOBAL if that is set. hk installed the hooks in the correct file but always said ~/.gitconfig. hk now asks git which file holds the hooks. Messages from hk install --global, hk uninstall --global, skipped per-repo installs and hk install --force-local now name that file. If git can't report one, the messages say "the global git config".

New Contributors

Full Changelog: v2.8.1...v2.8.2

💚 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.

Don't miss a new hk release

NewReleases is sending notifications on new releases.