codespell mysteries explained
Joseph Sutton
jsutton at samba.org
Tue Aug 22 01:29:30 UTC 2023
On 22/08/23 12:58 pm, Douglas Bagnall via samba-technical wrote:
> I was trying to run
>
> codespell $(git diff origin/master --name-only)
>
> to catch my typos before CI does, but they seem to find completely
> disjoint sets of complaints. That is, *none* of the local codespell
> issues were raised by CI, and vice versa.
>
> Locally I have "codespell 2.1.0" on Ubuntu 22.04. It doesn't care when I
> write "secuirty" in a C comment, while CI does. And it does say a lot of
>
> python/samba/tests/sddl.py:193: BA ==> BY, BE
>
> which CI doesn't mention.
>
> Adding "ba" to .codespellignore makes the "BA" complaints disappear. I
> would prefer to just ignore uppercase "BA", but when the manpage says
>
> Words are case sensitive based on how they are written in
> the dictionary file
>
> it is saying you *can't* ignore uppercase only if the codespell
> dictionary[1] doesn't contain a "BA->..." line. It doesn't.
>
> [1]/usr/lib/python3/dist-packages/codespell_lib/data/dictionary.txt
>
> The local dictionary also doesn't contain "secuirty". The upstream
> version does, and it doesn't have the "ba". So that explains everything.
>
> When I started this email, it was going to be along the lines of "WTF am
> I missing", but it turns out to be quite simple. If you have an ancient
> OS (from, say, last year) don't expect to be able to replicate codespell
> CI locally.
>
> Douglas
>
It seems that there is a way to get a more recent dictionary for those
of us who are stuck on an older version of codespell:
https://github.com/codespell-project/codespell#updating-the-dictionaries
I’m not sure exactly which dictionary the CI will be using, but the
latest version should at least be closer to it than whatever Ubuntu has.
It might be a good idea to use the ‘-D’ option in codespell.sh to
specify a particular local dictionary (or dictionaries), so that
spelling is enforced consistently for everyone.
Joseph
More information about the samba-technical
mailing list