codespell-project / codespell

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

Unable to Ignore Files Completely Using .codespell.toml Configuration #3446

Open Sohan-Opstree opened 1 month ago

Sohan-Opstree commented 1 month ago

Issue Description:

I have configured a .codespell.toml file to ignore certain files in my project, such as requirements.txt and *.csv. However, despite following the documentation, I'm unable to completely ignore the CHANGELOG.md file.

Steps to Reproduce:

Create a .codespell.toml file with the following configuration:

[tool.codespell]
skip = 'requirements.txt,*.csv,CHANGELOG.md'

Set up the pre-commit hook in the project's configuration:

pre-commit hook:

  - repo: https://github.com/codespell-project/codespell
    rev: v2.3.0
    hooks:
      - id: codespell
        additional_dependencies:
          - tomli
        args:
          - --ignore-words=.config/.codespellignore
          - --config=.config/.codespell.toml

Run pre-commit run --all-files codespell. Expected Behavior: The CHANGELOG.md file should be completely ignored by codespell, as specified in the .codespell.toml configuration file.

Actual Behavior:

The CHANGELOG.md file is not being ignored entirely, leading to errors during the codespell check.

pre-commit run --all-files codespell
codespell................................................................Failed
- hook id: codespell
- exit code: 65

CHANGELOG.md:253: re-declared ==> redeclared
DimitriPapadopoulos commented 1 month ago

It works for me:

$ cat example.toml 
[tool.codespell]
skip = 'requirements.txt,*.csv,CHANGELOG.md'
$ 
$ cat CHANGELOG.md 
re-declared
$ 
$ codespell
./CHANGELOG.md:1: re-declared ==> redeclared
$ 
$ codespell --toml example.toml 
$