shlogg · Early preview
Kojix2 @kojix2

Find Typos In OSS Projects With Typos & Ruby One-Liner

Find typos in OSS projects with `typos` command & Ruby one-liner: sort by highlighted word length for most likely errors. Fixing typos makes friendly pull requests!

Let's Find Those Typos

typos.

typos --format brief --color always | ruby -e 'puts ARGF.readlines.sort_by{|l| l[/`.*?`/].size}'

    
    

    
    




If you split it into multiple lines:

typos --format brief --color always |
ruby -e 'puts ARGF.readlines.sort_by{|l| l[/`.*?`/].size}'

    
    

    
    




With this, you should be able to find typos in most OSS projects.
However, if it catches too many typos in changelogs/README instead of the actual code, try using the fd command to specify file extensions or exclude directories.
For example, the following command searches only for .c...