From 8455184cd867897bc9f154531df4bb53c1f384f6 Mon Sep 17 00:00:00 2001 From: Angelos Stylianidis Date: Sat, 6 Jun 2026 02:02:39 +0300 Subject: [PATCH] feat: allow configuring clippy allowed lints --- modules/hooks.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index d1bf0191..13074d33 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -283,6 +283,12 @@ in description = "Additional arguments to pass to clippy"; default = ""; }; + allowedLints = mkOption { + type = types.listOf types.str; + description = "Lints to allow, passed to clippy as `-A `"; + default = [ ]; + example = [ "clippy::too_many_arguments" ]; + }; }; config.extraPackages = [ @@ -2955,7 +2961,7 @@ in description = "Lint Rust code."; package = wrapper; packageOverrides = { cargo = tools.cargo; clippy = tools.clippy; }; - entry = "${hooks.clippy.package}/bin/cargo-clippy clippy ${cargoManifestPathArg} ${lib.optionalString hooks.clippy.settings.offline "--offline"} ${lib.optionalString hooks.clippy.settings.allFeatures "--all-features"} ${hooks.clippy.settings.extraArgs} -- ${lib.optionalString hooks.clippy.settings.denyWarnings "-D warnings"}"; + entry = "${hooks.clippy.package}/bin/cargo-clippy clippy ${cargoManifestPathArg} ${lib.optionalString hooks.clippy.settings.offline "--offline"} ${lib.optionalString hooks.clippy.settings.allFeatures "--all-features"} ${hooks.clippy.settings.extraArgs} -- ${lib.optionalString hooks.clippy.settings.denyWarnings "-D warnings"} ${lib.concatMapStringsSep " " (lint: "-A ${lib.escapeShellArg lint}") hooks.clippy.settings.allowedLints}"; files = "\\.rs$"; pass_filenames = false; };