typos
typos copied to clipboard
Checking all files in git index
I am a ~~devops person~~ GitHub junky meeting many projects. Sad new is in #779 😢 I need to check every single file in a git repository, not in the filesystem. Today I've learned that Typos ignores dotfiles and dotdirectories even when they are under vcs control.
Tried typos --hidden but that also check .git/* files.
Tried typos $(git ls-files) but that has problems with files with whitespaces in the filename.
How to run Typos on all files in git index, not on the filesystem?
typos --hidden --exclude=.git/ feels so bad! Like giving Typos a crutch.
You can use git ls-files | xargs typos - see my post.
Thank you @adamchainz!
Could it be that this command will have problems with spaces in the filename? https://github.com/szepeviktor/adam-vs-xargs/actions/runs/5789737478/job/15691397394
Try git ls-files -z | xargs -0 ls -l
Done 🍏 https://github.com/szepeviktor/adam-vs-xargs/blob/449364e020f5a1144ba04aa2b547203c24c1f408/.github/workflows/blanky.yml#L14
@epage Could we use git ls-files -z | xargs -0 -- typos instead of typos . in the action?
I've now updated my post to use null byte separators.
Compacted the action down to ~10 lines https://github.com/szepeviktor/byte-level-care/blob/f47f5c28505d14e7aa7a3a1fa0fa605fe3163ee4/.github/workflows/spelling.yml#L38-L49 but I do not want to cook at home!
Passing files in will make people hit #347