-
Notifications
You must be signed in to change notification settings - Fork 467
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
Feature: Ignore files not under version control #3300
Comments
Currently codespell is a simple piece of software focused on processing the arguments it is given, without filters — except for hidden files. I am not certain adding filters is worth the extra complexity. You could instead modify the arguments passed to codespell. Any way, I'll let maintainers decide. |
The use case is that when running it from the CLI with local files used for development, these files are codespell'ed as well and when running the script to ignore line that are misspelled, lines from files not under version control also got added. |
this might also be a very nice alternative to needing to explicit list to ignore all of those other folders ( edits:
|
OK, you convinced me. Which version control though? Not everyone uses git. |
I vote for git - I moved almost all my subversion projects to git, rcs/cvs has been long gone, and it's what I encounter the most. |
Note that git can do this: git ls-files -- ':*php'
git ls-files -- . ':!*sql' ':!*bin' So the file glob patterns could all be provided to |
well, could be a setting use without -z ❯ mkdir /tmp/test; cd /tmp/test; git init; echo 1 > "new
line"; touch empty; touch '"quoted"'; git add *; git commit -m "added files"; git ls-files
Initialized empty Git repository in /tmp/test/.git/
[master (root-commit) 8bd959f] added files
3 files changed, 1 insertion(+)
create mode 100644 "\"quoted\""
create mode 100644 empty
create mode 100644 "new\nline"
"\"quoted\""
empty
"new\nline" with
[*] In DataLad we programmatically compose "most obscure" (although still without new line IIRC) filename for a filesystem at hands during testing: https://github.com/datalad/datalad/blob/maint/datalad/tests/utils_pytest.py#L1453 . So on my laptop it is : ❯ python -c 'from datalad.tests.utils_pytest import OBSCURE_FILENAME; print(repr(OBSCURE_FILENAME))'
' |;&%b5{}\'"<>ΔЙקم๗あ .datc ' NB if you use debian package -- there would be no unicode part. so note spaces leading/trailing it to ensure we do not strip them anywhere... |
Context:
I created a script to add lines to the file ignore list that I can run if there are only false codespell positives.
I want to exclude files that are not under git version control as these do not need to be added as exceptions.
It seems appropriate and useful that 'codespell' has an option to do so.
For example, the following shell command filters to only files that are under version control:
git ls-files $(ls -p | grep -v -E '/$')
.I could apply something like that to the script by using the codespell output two times or running it a second time on the filtered files.Done.However, excluding files that are not under version controls seems like a good filter for codespell.
EDIT: updating the ignored lines file could even be a feature in codespell.
The text was updated successfully, but these errors were encountered: