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

--skip doesn't work #2047

Open
DimitriPapadopoulos opened this issue Aug 22, 2021 · 5 comments
Open

--skip doesn't work #2047

DimitriPapadopoulos opened this issue Aug 22, 2021 · 5 comments

Comments

@DimitriPapadopoulos
Copy link
Collaborator

I might be doing something stupid, but I cannot find a way to skip these files or folders:

tests/ci/checkpatch/spelling.txt
tests/ci/checkpatch/
.git/

I have tried the three variants -S, --skip, --skip= and all these forms:

--skip ./tests/ci/checkpatch/spelling.txt
--skip tests/ci/checkpatch/spelling.txt
--skip ./tests/ci/checkpatch/
--skip ./tests/ci/checkpatch
--skip tests/ci/checkpatch/
--skip tests/ci/checkpatch
--skip ./.git/
--skip ./.git
--skip .git/
--skip .git

The only thing that seems to be working for tests/ci/checkpatch/spelling.txt is:

--skip spelling.txt
@bwitt
Copy link
Contributor

bwitt commented Aug 22, 2021

I think this is related to #1915

@vikivivi
Copy link
Contributor

vikivivi commented Aug 22, 2021

Creating a test environment.

mkdir -p test/.git
mkdir -p test/.svn
mkdir -p test/log
mkdir -p test/inc
mkdir -p test/src
mkdir -p test/res
cd test/
echo abotu >> .git/test.txt
echo abotu >> .svn/test.txt
echo abotu >> src/my-test.c
echo abotu >> inc/my-test.h
echo abotu >> res/test.jpg
echo abotu >> res/test.png
echo abotu >> log/test.log

Here is my test results without --skip

codespell 
./log/test.log:1: abotu ==> about
./src/my-test.c:1: abotu ==> about
./res/test.png:1: abotu ==> about
./res/test.jpg:1: abotu ==> about
./inc/my-test.h:1: abotu ==> about

My test results after adding --skip

codespell --skip=.git,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about

codespell --skip .git,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about

codespell -S .git,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about

It seem to me that it is unable to handle sub-directory slash in --skip well.

mkdir -p src/3rd-party
mkdir -p inc/3rd-party
echo abotu >> src/3rd-party/test.c
echo abotu >> inc/3rd-party/test.h

codespell -S .git,src/3rd-party,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about
./src/3rd-party/test.c:1: abotu ==> about

@DimitriPapadopoulos
Copy link
Collaborator Author

Indeed, --skip .git does work after all. Probably an issue with / as you write.

@vikivivi
Copy link
Contributor

@DimitriPapadopoulos To skip sub-directory, you will need to start with ./

  • This one won't work.
codespell -S .git,src/3rd-party,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about
./src/3rd-party/test.c:1: abotu ==> about
  • This one is working when you start with ./ for sub-directory.
codespell -S .git,./src/3rd-party,log,*.png,*.jpg,inc
./src/my-test.c:1: abotu ==> about

@DimitriPapadopoulos
Copy link
Collaborator Author

Yes, I've just noticed that. Do you agree it's a nuisance? I plan on fixing it.

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

No branches or pull requests

3 participants