Skip to content

Commit 6007ee9

Browse files
committed
feat(typos): multiple exclude globs
1 parent ff52e34 commit 6007ee9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/hooks.nix

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,10 +1831,10 @@ in
18311831

18321832
exclude =
18331833
mkOption {
1834-
type = types.str;
1835-
description = "Ignore files and directories matching the glob.";
1836-
default = "";
1837-
example = "*.nix";
1834+
type = with types; coercedTo str (s: [ s ]) (listOf str);
1835+
description = "Ignore files and directories matching one of the globs.";
1836+
default = [ ];
1837+
example = [ "*.nix" ];
18381838
};
18391839

18401840
force-exclude =
@@ -3998,8 +3998,10 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
39983998
package = tools.typos;
39993999
entry =
40004000
let
4001-
inherit (hooks.typos.settings) config;
4001+
inherit (hooks.typos.settings) config exclude;
40024002
configFile = toml.generate "typos-config.toml" config;
4003+
excludeFlags = lib.concatStringsSep " "
4004+
(lib.map (glob: "--exclude ${glob}") exclude);
40034005
cmdArgs =
40044006
mkCmdArgs
40054007
(with hooks.typos.settings; [
@@ -4008,7 +4010,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
40084010
[ (config != { }) "--config ${configFile}" ]
40094011
[ (configPath != "" && config == { }) "--config ${configPath}" ]
40104012
[ diff "--diff" ]
4011-
[ (exclude != "") "--exclude ${exclude}" ]
4013+
[ (exclude != [ ]) excludeFlags ]
40124014
[ force-exclude "--force-exclude" ]
40134015
[ (format != "long") "--format ${format}" ]
40144016
[ hidden "--hidden" ]

0 commit comments

Comments
 (0)