Skip to content

Commit c83f6ee

Browse files
committed
gitlint: add flags option
`gitlint.args` can not be used since pre-commits appends it to the commandline but the `--msg-filename` option has to come last. See #641 for more information.
1 parent ca5b894 commit c83f6ee

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

modules/hooks.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,18 @@ in
639639
};
640640
};
641641
};
642+
gitlint = mkOption {
643+
description = "gitlint hook";
644+
type = types.submodule {
645+
imports = [ hookModule ];
646+
options.flags = mkOption {
647+
type = types.listOf types.str;
648+
description = "Flags passed to gitlint. See all available [here](https://jorisroovers.com/gitlint/latest/configuration/cli/)";
649+
default = [ ];
650+
example = [ "-c" "title-max-length.line-length=120" ];
651+
};
652+
};
653+
};
642654
golines = mkOption {
643655
description = "golines hook";
644656
type = types.submodule {
@@ -2933,7 +2945,11 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
29332945
name = "gitlint";
29342946
description = "Linting for your git commit messages";
29352947
package = tools.gitlint;
2936-
entry = "${hooks.gitlint.package}/bin/gitlint --staged --msg-filename";
2948+
entry = lib.escapeShellArgs (
2949+
[ "${hooks.gitlint.package}/bin/gitlint" ]
2950+
++ hooks.gitlint.flags
2951+
++ [ "--staged" "--msg-filename" ]
2952+
);
29372953
stages = [ "commit-msg" ];
29382954
};
29392955
gofmt =

0 commit comments

Comments
 (0)