Skip to content

Use codespell to detect common misspellings #2671

Closed

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

Activity

  1. added
    question
    on Sep 7, 2023
  2. michaelgrund commented on Sep 7, 2023

    @michaelgrund
    Member

    Sounds good to me to have at least an automatic procedure to detect the most common typos and misspellings.

  3. seisman commented on Sep 7, 2023

    @seisman
    MemberAuthor

    3. Use the codespell GitHub Actions actions-codespell to detect misspellings in PRs

    I don't think we should use the codespell GitHub Actions. Here are my reasons:

    • Misspellings are just very tiny bugs, and they are not worth wasting CI resources.
    • It still produces many false-positives, especially for ReST/Markdown syntax which uses non-word characters (e.g., *) very often. Enabling spellcheck may distract contributors from their PRs.
    • We can have more misspelling issues as "good first issues" (xref: Fix some typos #1057 (review)).
    • Add "Running codespell --skip=.git to check common misspellings" to the release checklist, so that we can fix some typos before a release
    • 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.

    The good news is that codespell supports pyproject.toml, so we can maintain the list of valid words in pyproject.toml. Before each release, we just need to run codespell once, then we can fix any detected misspellings and also update the word list in pyproject.toml to reduce false-positives.

  4. added
    maintenance
    and removed
    question
    on Sep 8, 2023
  5. added this to the 0.11.0 milestone on Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions