Skip to content

Commit

Permalink
Added args and exclude_types to hook type
Browse files Browse the repository at this point in the history
  • Loading branch information
joedevivo committed Mar 22, 2024
1 parent e611897 commit 72bce63
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions modules/hook.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ in
default = [ ];
};

exclude_types = mkOption {
type = types.listOf types.str;
description = lib.mdDoc
''
List of file types to exclude. See [Filtering files with types](https://pre-commit.com/#plugins).
'';
default = [ ];
};

pass_filenames = mkOption {
type = types.bool;
description = lib.mdDoc ''
Expand Down Expand Up @@ -178,6 +187,14 @@ in
if true this hook will run even if there are no matching files.
'';
};

args = mkOption {
type = types.listOf types.str;
description = lib.mdDoc ''
List of additional parameters to pass to the hook.
'';
default = [ ];
};
};

config = {
Expand All @@ -186,6 +203,7 @@ in
inherit (config) name entry language files types types_or pass_filenames fail_fast require_serial stages verbose always_run;
id = config.name;
exclude = mergeExcludes config.excludes;
inherit exclude_types args;
};
};
}
3 changes: 2 additions & 1 deletion modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,8 @@ in
description = "Format shell files.";
types = [ "shell" ];
package = tools.shfmt;
entry = "${hooks.shfmt.package}/bin/shfmt -w -s -l";
entry = "${hooks.shfmt.package}/bin/shfmt -w -l";
args = [ "-s" ];
};
staticcheck =
{
Expand Down

0 comments on commit 72bce63

Please sign in to comment.