-
Notifications
You must be signed in to change notification settings - Fork 465
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
Behavior of --skip with folder names #1915
Comments
In my case, none of these work:
|
>>> fnmatch.fnmatch(".git", "./.git")
False
>>> fnmatch.fnmatch("./.git", "./.git")
True
>>>
>>> fnmatch.fnmatch(".git", "./.git/")
False
>>> fnmatch.fnmatch("./.git", "./.git/")
False
>>> I guess the key is in the
|
With the following setup: $ tree
.
└── tests
└── ci
└── checkpatch
└── spelling.txt
3 directories, 1 file
$
>>> fnmatch.fnmatch("./tests/ci/checkpatch", "tests/ci/checkpatch")
False
>>>
>>> fnmatch.fnmatch("./tests/ci/checkpatch", "tests/ci/checkpatch/")
False
>>>
>>> fnmatch.fnmatch("./tests/ci/checkpatch", "./tests/ci/checkpatch/")
False
>>>
>>> fnmatch.fnmatch("./tests/ci/checkpatch", "./tests/ci/checkpatch")
True
>>> I don't know why I thought it didn't in #2047 - I was probably tired and confused by too many attempts to understand. So we just need to:
|
The trailing About the leading
Clearly, something's wrong here. We want to match relative paths - relative to the directory passed as an argument to codespell. Instead, codespell prepends the directory to the file path, or |
For the record,
My use case is running codespell via GitHub Actions only on files changed in a PR instead of the whole repository (so passing an explicit list of changed files, using the method in codespell-project/actions-codespell#65), but still using a skip list to ignore thirdparty files, various specific files with false positive typos, and |
You're doing the exact opposite of what you want, you are actually instructing codespell to check
|
I think you misunderstood my example. I want codespell to ignore all files in the It works fine with individual files on the skip list, but not with folders:
There's still this issue of mismatch between paths with or without the You may ask why I'm specifying the file manually in the list of paths to check if I also want to skip it, but that was just to have a simple example. My real use case is as described above. In script form:
Or shorter with what matters:
(And the |
I think you misunderstood me, and I still think you do the exact opposite of what you would want. Have a look at my examples: |
I'm fully aware, and I know what I'm doing. I think the workaround I had to do in godotengine/godot#76842 for this bug makes my use case very explicit. The non pseudo code example I gave here makes it very clear that I know how to use In case it's not clear:
I'm making use of this optional |
In the example you have sent, it may be expected that codespell does not skip
This is a corner case, where at the same time you ask codespell to check a file and to skip it:
Should the In any case, the whole skipping business needs to be overhauled, a large part of the broken use cases involve This works:
|
The three examples you quoted show clearly that what I'm expecting (skip takes precedence over explicit files listing when there's a conflict) works fine for files, and not for folders in the skip list. But I leave it at that, we won't understand each other evidently. |
Let's start over. These examples actually raise a precedence question. Explicit file argument or skip list? I think the skip list should win, and that is what usually happens. However, in this case, we do seem to have a precedence issue with folders:
But then, I feel this a different issue, not the usual |
Also these should all work the same:
--skip ./foo/
- Currently doesn't work--skip ./foo
- Currently works--skip foo/
- Untested--skip foo
- UntestedWe also need to check if
--skip ./foo
is equivalent to--skip ./foobar
(on a file/folder named foobar) and likewise for--skip foo
.Originally posted by @peternewman in #1528 (comment)
The text was updated successfully, but these errors were encountered: