Skip to content

Commit a4548c0

Browse files
authored
Merge pull request #221 from notgne2/clippy-deny-warnings
Add option to fail when clippy emits warnings
2 parents 6bf7e08 + 11c6d36 commit a4548c0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/hooks.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,16 @@ in
313313
default = false;
314314
};
315315
};
316+
317+
clippy =
318+
{
319+
denyWarnings = mkOption {
320+
type = types.bool;
321+
description = lib.mdDoc "Fail when warnings are present";
322+
default = false;
323+
};
324+
};
325+
316326
};
317327

318328
config.hooks =
@@ -648,7 +658,7 @@ in
648658
{
649659
name = "clippy";
650660
description = "Lint Rust code.";
651-
entry = "${wrapper}/bin/cargo-clippy clippy ${cargoManifestPathArg}";
661+
entry = "${wrapper}/bin/cargo-clippy clippy ${cargoManifestPathArg} -- ${lib.optionalString settings.clippy.denyWarnings "-D warnings"}";
652662
files = "\\.rs$";
653663
pass_filenames = false;
654664
};

0 commit comments

Comments
 (0)