Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--ignore-words should itself be a --skip implicitly #3293

Open
Alexander-Shukaev opened this issue Jan 16, 2024 · 1 comment
Open

--ignore-words should itself be a --skip implicitly #3293

Alexander-Shukaev opened this issue Jan 16, 2024 · 1 comment

Comments

@Alexander-Shukaev
Copy link

As per title, otherwise codespell fixes the ignore file itself which makes no sense anyway.

@Alexander-Shukaev Alexander-Shukaev changed the title --ignore-file should itself be a --skip implicitly --ignore-words should itself be a --skip implicitly Jan 16, 2024
@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Jan 16, 2024

I actually tested that very use case yesterday in the context of #3206, and it worked for me:

$ mkdir test
$ cd test
/tmp/test
$ 
$ cat > aare.txt
aare
$ codespell .
aare.txt:1: aare ==> are
$ 
$ cat > aadd.txt
aadd
$ codespell .
./aadd.txt:1: aadd ==> add
./aare.txt:1: aare ==> are
$ 
$ cat > ignore.txt 
aare
aadd
$ codespell .
./aadd.txt:1: aadd ==> add
./aare.txt:1: aare ==> are
./ignore.txt:1: aare ==> are
./ignore.txt:2: aadd ==> add
$ 
$ codespell --ignore-words ignore.txt .
$ 

There are two ways to handle such a situation:

  1. Since --ignore-words lists the word to ignore, these words will be ignored, including in the files passed as argument to --ignore-words. No real need to skip these files.
  2. Make sure these files are not even read. That's probably the right thing to do.

I guess codespell uses mechanism 1. The right thing to do would be to switch to mechanism 2, but this would require other PRs such as #2058 to be merged first. So let's stick to mechanism 2 for now. I guess your issue is a case issue similar to #3248. You should be able to take care of it by fixing the case of the words to ignore, or by testing master branch that includes recent PR #3272.

Does this help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants