codespell-project / codespell

check code for common misspellings
GNU General Public License v2.0
1.9k stars 466 forks source link

Inline word skipping does not work - at least within SublimeText #3494

Closed LinuxOnTheDesktop closed 3 months ago

LinuxOnTheDesktop commented 3 months ago

The README gives one to believe that codespell allows one, via a comment in source-code file, to skip a codespell suggestion for a particular word (and to do so, I take it, for the whole file). The README gives this example:

def wrod() # codespell:ignore wrod pass

Yet, when I do the following, in Sublime Text with the linter 'SublimeLinter-contrib-codespell' installed, I see this:

image

Perhaps though the problem lies with the Sublime Linter (i.e., with SublimeLinter-contrib-codespell). Or perhaps I misunderstand something.

DimitriPapadopoulos commented 3 months ago

Can you reproduce with codespell? I don't know how Sublime Text and Sublime Linter use codespell, and which version of it.

By the way, the README is updated with the latest changes in the master branch, it's not specific to a released version.

LinuxOnTheDesktop commented 3 months ago

Can you reproduce with codespell? I don't know how Sublime Text [. . .]

I can:

$ codespell ~/scripts/sendFile/syncIn
/home/[me]/scripts/sendFile/syncIn:2: syncIn ==> syncing, sync in
/home/[me]/scripts/sendFile/syncIn:3: syncIn ==> syncing, sync in
DimitriPapadopoulos commented 3 months ago

Please attach a minimal ~/scripts/sendFile/syncIn file that reproduces the problem.

LinuxOnTheDesktop commented 3 months ago

Here you go.

#!/usr/bin/env bash
# codespell: ignore syncIn
# NAME              syncIn
DimitriPapadopoulos commented 3 months ago

There are multiple issues in the above file. Try this instead:

#!/usr/bin/env bash
# NAME              syncIn  # codespell:ignore syncin
LinuxOnTheDesktop commented 3 months ago

   Thanks. I take it that you mean the following.

1) The codespell directive ought to follow, i.e. come after, the text that it means to allow. 2) The argument in the ignore directive ought to be entirely in lowercase.

1 - and 2? - is per the instructions. I find both 1 and 2 counter-intuitive.

DimitriPapadopoulos commented 3 months ago

1 is pretty standard in linters or spellcheckers. It's not after, it's the same line.

2 is a known issue. There's already an open issue describing the causes and possible fixes.

LinuxOnTheDesktop commented 3 months ago

Re 1: aha; I was not aware of that - because no other linter that I use within Sublime works in that way. Re 2: right.