Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added args and exclude_types to hook type #414

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List of file types to exclude. See [Filtering files with types](https://pre-commit.com/#plugins).
List of file types to exclude. See [Filtering files with types](https://pre-commit.com/#filtering-files-with-types).

'';
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
Loading