typos: Excluding files unexpected behavior.
Current settings:
_typos.toml
[files]
extend-exclude = ["*.json", "**/*.json"]
.pre-commit-config.yaml
- repo: https://github.com/crate-ci/typos
rev: typos-v0.7.4
hooks:
- id: typos
Expected behavior: JSON files must be excluded
Expected behavior: All files are checked.
Steps to reproduce
pre-commit run typos --all-files
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 22 (2 by maintainers)
Commits related to this issue
- test(pre-commit): exclude tests/cassettes/ from typos This would be better placed in `.typos.toml` rather than pre-commit config, but at time of writing, `typos` doesn't honor exclusions for explicit... — committed to scop/pytekukko by scop 2 years ago
- test(pre-commit): exclude tests/cassettes/ from typos This would be better placed in `.typos.toml` rather than pre-commit config, but at time of writing, `typos` doesn't honor exclusions for explicit... — committed to scop/pylttoaine by scop 2 years ago
- test(pre-commit): exclude tests/cassettes/ from typos This would be better placed in `.typos.toml` rather than pre-commit config, but at time of writing, `typos` doesn't honor exclusions for explicit... — committed to scop/pylttoaine by scop 2 years ago
- fix(action): Don't pre-filter checked files This reverts commit fc7f51746699c0dacd6a3c2a8f594a18c1726336. This has two problems - This doesn't correctly handle spaces, likely needing #708 - This ove... — committed to epage/typos by epage 10 months ago
- Merge pull request #837 from Delgan/GH-347-add-force-exclude Add "--force-exclude" option — committed to crate-ci/typos by epage 9 months ago
Additional workaround is:
Got it from here as the same issue exists in interrogate package
What about the hook attribute exclude ? It can exclude files with specified pattern.
This is what I’m using. For example:
You can also explicitly limit to certain file types by overriding the
texttype selected in the repo’s hook definition:IMO one of the powers of pre-commit is that it already passes the correct filenames, based on hook selection and exclusion, so tools don’t have to reimplement undifferentiated inclusion/exclusion features.