Skip to content

codespell blocking documentation commit on attribute name #3888

Closed

Description

@rob-miller

I have an attribute .aks in code that I'm documenting, but codespell blocks the commit in the tutorial because it thinks I mean 'ask'.
There doesn't seem to be any in-file codespell directive to ignore the lines, is there some other suggested workaround?

Activity

  1. erik-whiting commented on Mar 25, 2022

    @erik-whiting
    Contributor

    Here's a PR to address this issue, it's a pretty easy fix. Any maintainers, please let me know if this requires a different approach. (will keep an eye on the build to see if anything else needs tweaking)

  2. rob-miller commented on Mar 26, 2022

    @rob-miller
    ContributorAuthor

    Thanks, but I don’t understand from the PR (admittedly trying to navigate from my phone) what it does or how I use it. I’m trying to commit Tutorial.tex with doctest code causing the problem.

  3. erik-whiting commented on Mar 26, 2022

    @erik-whiting
    Contributor

    Thanks, but I don’t understand from the PR (admittedly trying to navigate from my phone) what it does or how I use it. I’m trying to commit Tutorial.tex with doctest code causing the problem.

    The PR adds .aks to the things codespell ignores as a spelling mistake. So, if my PR is approved and merged, then codespell won't block your commit anymore (assuming you rebase when/if my PR is merged).

    Alternatively, you can just copy the change I made in my PR into your own to stop codespell from blocking your commit.

    To make it super easy on you, download this file:
    diff.txt
    and then from within your repository run git apply path/to/diff.txt and then commit. That should take stop codespell from blocking you.

  4. rob-miller commented on Mar 26, 2022

    @rob-miller
    ContributorAuthor

    From reading the diff (sorry away from computer until Tuesday) it looks like this excludes files with a .aks extension? Sorry if I’m misunderstanding, but seems like the change should go in the next line, to ignore ‘aks’ because it’s not a mis-spelling of ‘ask’…. In three lines of one file of the entire project.

    Obviously I can add this exception, but it just seems like a bad approach and non-obvious to developers going forward. Codespell has a feature request for in-line ignores outstanding since 2019, and just doesn’t feel like the right tool to use at this time without it. @peterjc view?

  5. rob-miller commented on Mar 26, 2022

    @rob-miller
    ContributorAuthor

    Thank you @erik-whiting for showing me where to make the fixes. There also seems to be an option to specify a file of lines to ignore but have not worked out the details. See discussion at codespell 1212

  6. peterjc commented on Mar 31, 2022

    @peterjc
    Member

    You can add special words to the -L argument for codespell here: https://github.com/biopython/biopython/blob/master/.pre-commit-config.yaml

    i.e. It would be in addition to ser (for amino acid serine) etc:

    -   repo: https://github.com/codespell-project/codespell
        rev: v2.1.0
        hooks:
        -   id: codespell
            files: \.(rst|md|tex)$
            args: [
                --ignore-regex,
                '(^|\W)([A-Z]{2,3})(\W|$)',
                -L,
                'ser,hsa,hist,fpr'
            ]
            
    

    See #3709, "This is configured to check *.rst, *.md and *.tex files only (hard to do directly with codespell, easy in pre-commit), uses a regex to ignore 2 and 3 letter upper case acronyms, and ignores a handful of words."

    (I've not seen the code, but is .aks really the best name for this attribute?)

  7. rob-miller commented on Apr 1, 2022

    @rob-miller
    ContributorAuthor

    Yes, I was able to add 'aks' to .pre-commit-config.yaml and commit. Reflecting on your other comment (and my own comments in the code about what '.aks' refers to :-)), I have refactored to make the name more meaningful.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions