Catch Typos Early with crate-ci/typos

Typos can creep into any codebase, but they don't have to slow you down. crate-ci/typos is a handy tool that helps you identify and fix typos in your project.

Here's how to get started:

  1. Install typos-cli:
conda add typos-cli

You can also install typos-cli using conda, pacman. Check the installation for details on installing packages from other channels.

  1. Run typos to check your code:
typos

This will scan your project and report any potential typos it finds.

error: `Bui` should be `Buoy`, `Buy`
--> ./nuxt.config.ts:68:22
   |
68 |       me: 'Anh Thang Bui',
   |                      ^^^
   |
error: `Bui` should be `Buoy`, `Buy`
--> ./README.md:2:32
|
2 |   <h1 align="center">Anh Thang Bui</h1>
|                                ^^^
|

typos-cli won't automatically change your code, but it will highlight the typos and suggest corrections. You can review the suggestions and make the necessary changes or have them fixed

typos --write-changes
typos -w
  1. Important! Review the suggestions carefully
    • typos-cli is a powerful tool, but it might flag names or data coming from third-party APIs as typos.
    • Do not change typos that match field names, parameter names, or other data received from external APIs. Changing these could break your communication with the API.
    • Make the necessary changes to typos that are actually errors in your code.

Bonus: Integrate typos-cli into your CI pipeline to catch typos early and often.

By using crate-ci/typos, you can keep your code clean and professional!

#typos #crate-ci