Skip to content

Use codespell to detect common misspellings #2671

@seisman

Description

@seisman

We all make spelling mistakes.

I find the codespell tool useful for checking common misspellings (see PR #1057, #2670, and also many PRs in the GMT repository). But we should also be aware that the tool is not perfect and it still generates some false-positives. For examples, after PR #1057, running codespell --skip=.git gives:

./pyproject.toml:128: reenable ==> re-enable
./pygmt/helpers/decorators.py:189: oints ==> points, pints
./pygmt/tests/test_basemap.py:59: Tripel ==> Triple
./pygmt/src/grdtrack.py:174: trough ==> through
./examples/projections/table/README.txt:71: Tripel ==> Triple
./examples/projections/misc/misc_winkel_tripel.py:2: Tripel ==> Triple
./examples/projections/misc/misc_winkel_tripel.py:7: tripel ==> triple
./examples/projections/misc/misc_winkel_tripel.py:11: Tripel ==> Triple
./examples/gallery/embellishments/colorbars_multiple.py:30: Tripel ==> Triple
./examples/gallery/symbols/custom_symbols.py:27: astroid ==> asteroid
./examples/gallery/symbols/custom_symbols.py:30: astroid ==> asteroid
./examples/tutorials/advanced/earth_relief.py:36: Tripel ==> Triple

Here are my thoughts about how we can use codespell better:

  1. Add "Running codespell --skip=.git to check common misspellings" to the release checklist, so that we can fix some typos before a release
  2. Maintain a list of words that should be ignored by codespell, for example, codespell --skip=.git -L astroid,tripel,trough,oints produces fewer false positives.
  3. Use the codespell GitHub Actions actions-codespell to detect misspellings in PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceBoring but important stuff for the core devs

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions