FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[MNT]: Add codespell to pre-commit hooks · Issue #22740 · matplotlib/matplotlib · GitHub

[MNT]: Add codespell to pre-commit hooks #22740

Closed

Description

Summary

In PR #22733 @QuLogic caught a spelling error of mine (which is great!) but there will inevitably be typos that slip through if only humans are checking. https://github.com/codespell-project/codespell is a really nice way to check for typos and it has a nice pre-commit hook. As Matplotlib already uses pre-commit 🚀 (thanks to @ianhi in PR #21583) this would be an easy add. 👍

Proposed fix

Add the following hook (maybe some variations) to .pre-commit-config.yaml

  - repo: https://github.com/codespell-project/codespell
    rev: v2.1.0
    hooks:
      - id: codespell
        files: ^.*\.(py|c|h|md|rst|yml)$
        args: ["--write-changes", "--ignore-words-list", "hist,nd"]

Activity

  1. matthewfeickert commented on Mar 31, 2022

    ContributorAuthor

    Okay, so I have this working on my fork. To get things passing so that

    $ pre-commit run codespell --all-files
    codespell................................................................Passed

    passes I ended up using the --ignore-words option with corresponding file

    $ cat codespell-ignore-words.txt 
    ans
    axises
    ba
    cannotation
    coo
    curvelinear
    flate
    hist
    inout
    ment
    nd
    oly
    ot
    sur
    te
    thisy
    whis
    wit

    Matplotlib has a lot of abbreviations in the codebase that end up triggering some of these.

    @timhoffm @QuLogic @ianhi two questions that I figured you might have thoughts on given PR #21583:

    • Is the addition of a config file for a pre-commit hook something that you think the dev team would be open to? If so, is there a location other than the top level of the repo that would be a more appropriate location? Maybe the ci/ dir?
    • If the reason for all the words in the codespell-ignore-words.txt file is documented in the commit message do you think that would be sufficient? Or would people want to know exactly why these words are in this file by reading another file? It isn't possible to comment the codespell-ignore-words.txt with motivations for additions and have it still function.
  2. added this to the v3.6.0 milestone on May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL