github jdx/hk v1.38.0
v1.38.0: Fail on fix, cleaner builtins

9 hours ago

A small release that adds a new fail_on_fix hook option for workflows that want fixes applied but commits blocked, along with correctness improvements to several built-in linter configurations.

Added

  • fail_on_fix hook option: Hooks can now set fail_on_fix = true to fail when fix commands actually modify files. This is designed for stage = false pre-commit workflows where you want fixers to apply changes but block the commit so you can review and stage them manually. Defaults to false to preserve existing behavior. (@jdx) #725

    hooks {
        ["pre-commit"] {
            fix = true
            stage = false
            fail_on_fix = true
            steps = linters
        }
    }

Fixed

  • Cleaner builtin linter configs: Removed redundant check commands from black, ruff_format, and taplo_format builtins where check_diff already covers all issues. Removed check_diff from the ruff builtin because ruff check --diff can exit 0 even when non-fixable issues exist, which caused hk to incorrectly skip the fix step. Thanks @nkakouros! #726

Full Changelog: v1.37.0...v1.38.0

Don't miss a new hk release

NewReleases is sending notifications on new releases.