From 6b6a426c66d3debf2197174e4684dbb920921853 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 19 Apr 2024 18:48:25 +0200 Subject: [PATCH] typos: add force-exclude setting (default true) Although that is not the solution for the performance problems (in form of huge amounts of resources are consumed) of `typos` discussed in [0] and referenced discussions, this is technically the right thing to do and what users expect. [0]: https://github.com/cachix/git-hooks.nix/pull/405 --- modules/hooks.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index b5c81a84..cc5003bc 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -1476,6 +1476,15 @@ in example = "*.nix"; }; + force-exclude = + mkOption { + type = types.bool; + description = lib.mdDoc "Respect excluded files from config file even for paths passed explicitly"; + # This must be true as this is the natural behaviour. Similar to when executing `typos` + # from the cmdline. + default = true; + }; + format = mkOption { type = types.enum [ "silent" "brief" "long" "json" ]; @@ -3375,7 +3384,8 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol # Config file always exists (we generate one if not). [ true "--config ${pathToConfigFile}" ] [ diff "--diff" ] - [ (exclude != "") "--exclude ${exclude} --force-exclude" ] + [ (exclude != "") "--exclude ${exclude}" ] + [ (force-exclude) "--force-exclude" ] [ (format != "long") "--format ${format}" ] [ hidden "--hidden" ] [ (locale != "en") "--locale ${locale}" ]