codespell-project / codespell

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

Docs Request: how to put check-hidden into .codespellrc #2718

Open jamesbraza opened 1 year ago

jamesbraza commented 1 year ago

If I have the following .codespellrc for codespell==2.2.2:

[codespell]
check-filenames = True
check-hidden = True

And I run the below:

> codespell foo
usage: codespell [-h] [--version] [-d] [-c] [-w] [-D DICTIONARY] [--builtin BUILTIN-LIST] [--ignore-regex IGNORE_REGEX] [-I FILE] [-L WORDS] [--uri-ignore-words-list WORDS] [-r REGEX] [--uri-regex URI_REGEX] [-s] [--count] [-S SKIP]
                 [-x FILE] [-i INTERACTIVE] [-q QUIET_LEVEL] [-e] [-f] [-H] [-A LINES] [-B LINES] [-C LINES] [--config CONFIG] [--toml TOML]
                 [files ...]
codespell: error: unrecognized arguments: True

So this seems to be wrong. From a GitHub advanced search, I see this:

[codespell]
check-filenames =
check-hidden =

However, this is not clear to me, would the checks be enabled or disabled here?

Can you please document how to put check-filenames and check-hidden into the README? Thank you in advance

DimitriPapadopoulos commented 1 year ago

The README attempts to document that using examples:

    [codespell]
    skip = *.po,*.ts,./src/3rdParty,./src/Test
    count =
    quiet-level = 3

As you can see:

jamesbraza commented 1 year ago

Yeah I did see that in the README actually, and understand the mapping between CLI names and config names.

However, it's not clear how to use check-filenames/check-hidden. Do we just need their presence, or should we set to True?

[codespell]
check-filenames = True
check-filenames = 
DimitriPapadopoulos commented 1 year ago

--countcount =

jamesbraza commented 1 year ago

Ah I see, that clears me up... and thank you! Please feel free to close this issue.


One docs aspect I like in other Python tools is they have sample complete configs:

If codespell had one of these, I think it'd be helpful

DimitriPapadopoulos commented 1 year ago

Yes, there is room for improvement.

In this case, knowing the solution helped me understand the example in the documentation, instead of the other way round.