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 29f062e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 18 additions & 1 deletion 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,12 +187,20 @@ 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 = {
raw =
{
inherit (config) name entry language files types types_or pass_filenames fail_fast require_serial stages verbose always_run;
inherit (config) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args;
id = config.name;
exclude = mergeExcludes config.excludes;
};
Expand Down
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 29f062e

Please sign in to comment.