Skip to content

Commit 4b5fce7

Browse files
committed
feat(typos): multiple exclude globs
1 parent e94ce51 commit 4b5fce7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/hooks.nix

Lines changed: 7 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,9 @@ 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.map (glob: "--exclude ${glob}") exclude;
40034004
cmdArgs =
40044005
mkCmdArgs
40054006
(with hooks.typos.settings; [
@@ -4008,7 +4009,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
40084009
[ (config != { }) "--config ${configFile}" ]
40094010
[ (configPath != "" && config == { }) "--config ${configPath}" ]
40104011
[ diff "--diff" ]
4011-
[ (exclude != "") "--exclude ${exclude}" ]
4012+
([ (exclude != [ ]) ] ++ excludeFlags)
40124013
[ force-exclude " --force-exclude" ]
40134014
[ (format != "long") "--format ${format}" ]
40144015
[ hidden "--hidden" ]

0 commit comments

Comments
 (0)