-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Description
There are two issues with current implementation of the exclude parameter for the typos hook:
- the value should be passed in the apostrophes
"--exclude '${exclude}' --force-exclude"
, otherwise it is expanded by the shell and not working when more than one file is found - the additional excludes property (to be backward compatible) makes more sense since more than one glob can be defined with multiple
--exclude
CLI params:/nix/store/xxx-typos-1.32.0/bin/typos --config /nix/store/yyy-typos-config.toml --exclude '*.json1' --exclude '*.json' --exclude '*.json2' --force-exclude
. The--exclude '*.json1 *.json *.json2'
approach does not work:
/nix/store/xxx-typos-1.32.0/bin/typos --config /nix/store/yyy-typos-config.toml --exclude '*.json1 *.json *.json2' --force-exclude --dump-config - | grep exclude -A5
extend-exclude = [
"**.png",
"*.json1 *.json *.json2",
]
/nix/store/xxx-typos-1.32.0/bin/typos --config /nix/store/yyy-typos-config.toml --exclude '*.json1' --exclude '*.json' --exclude '*.json2' --force-exclude --dump-config - | grep exclude -A5
extend-exclude = [
"**.png",
"*.json1",
"*.json",
"*.json2",
]
The workaround is to use exclude property from the hook definition:
typos = {
excludes = [ ".*.yaml" ];
settings = {
exclude = "'**/*.json'";
};
};
All those observations empirically tested, implementation can be checked here: https://github.com/crate-ci/typos/blob/master/crates/typos-cli/src/bin/typos-cli/args.rs#L216
Metadata
Metadata
Assignees
Labels
No labels