You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable typos.configPath to be of type path. This way, we can
use excludes from .typos.toml when running
`pre-commit run typos --all-files`. Otherwise, the execution
differs from a normal invocation of typos, which is unexpected
and leads to wrong results.
To not break anything, and to be compliant with the existing
API, I modified configPath to be either a Nix path or a string.
The main motivation for this change is a repository on my machine
where pre-commit ignores directory foobar (which is excluded
by .typos.toml) but passes all 65,000 files of foobar as argument
to typos. In these situation, typos goes nuts and often the
system freezes.
So with this change, I prevent that possibly tens of thousands
of files that should not be checked in any case are passed to
typos, which results in a smooth experience.
[0]: cachix#387 (comment)
Copy file name to clipboardExpand all lines: modules/hooks.nix
+51-6Lines changed: 51 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1436,7 +1436,7 @@ in
1436
1436
configuration=
1437
1437
mkOption{
1438
1438
type=types.str;
1439
-
description=lib.mdDoc"Multiline-string configuration passed as config file. If set, config set in `typos.settings.configPath` gets ignored.";
1439
+
description=lib.mdDoc"Multiline-string configuration passed as config file. It is recommended to use `configPath` instead for a more natural experience of typos.";
1440
1440
default="";
1441
1441
example=''
1442
1442
[files]
@@ -1450,11 +1450,14 @@ in
1450
1450
'';
1451
1451
};
1452
1452
1453
+
# It is recommended to use a Nix path here as this way, the excludes
1454
+
# from the config file can be taken into account by pre-commit when
1455
+
# running `$ pre-commit run --all-files`.
1453
1456
configPath=
1454
1457
mkOption{
1455
-
type=types.str;
1456
-
description=lib.mdDoc"Path to a custom config file.";
description=lib.mdDoc"[Path](https://nixos.org/manual/nix/stable/language/values#type-path) to a typos config file (recommended) or a string (deprecated)";
0 commit comments