git-hooks.nix icon indicating copy to clipboard operation
git-hooks.nix copied to clipboard

treefmt settings do not include config or configPath

Open JayRovacsek opened this issue 1 year ago • 2 comments

Currently the treefmt hook does not support a configuration path option that would enable the reference of treefmt.toml. Without running treefmt --init or --config-file the check cannot be utilised in a consistent way if the config file is not committed to the repository

Happy to contribute a PR that adds this if deemed suitable :pray:

JayRovacsek avatar Apr 19 '24 23:04 JayRovacsek

The flake-parts module has a special integration that activates when you load both git-hooks.nix and treefmt-nix. Might that help?

It's defined here: https://github.com/cachix/git-hooks.nix/blob/40e6053ecb65fcbf12863338a6dcefb3f55f1bf8/flake-module.nix#L72

roberth avatar Apr 19 '24 23:04 roberth

Thanks for the fast response @roberth, unfortunately I don't utilise flake-parts myself (though I might be misunderstanding how I'd consume the flakeModule code)

Would the project be open to a PR that added a setting for config/configFile akin to the implementation for typos? (ref)

JayRovacsek avatar Apr 20 '24 04:04 JayRovacsek