Closed njajones closed 5 months ago
-fullpath
is included above as it is needed (I believe) with my real world use case, but in the example above it makes no difference
The workaround in #732 also works in this case i.e. cloc . -fullpath --not-match-d="/foo(/|$)"
Yes, this is a bug. If you run find
in the Developer
directory you'll see the same text that cloc will work on:
~/Developer » find . . ./clocTest ./clocTest/foo ./clocTest/foo/foo.swift ./clocTest/foo/bar ./clocTest/foo/bar/bar.swift
The ./clocTest/foo
directory doesn't satisfy the /foo/
pattern due to the missing trailing slash so the foo
directory is accepted, and subsequently--incorrectly--its child file foo.swift
is also accepted.
I need to add another check when examining files to make sure the parent directory doesn't match --not-match-d
. (The #732 workaround allows ./clocTest/foo
to be rejected since it matches /foo$
.)
Give ba6c1aa a try.
Works with my sample above. It's harder to test on my full project (as the use of cloc is quite deep in the code) but I'll give it a go
Fix works great. Thanks for the help
...and thanks for the contribution!
Describe the bug
--not-match-d=
excludes a folders subfolders, but not a file in that foldercloc; OS; OS version
To Reproduce
Expected result I'd expect to filter out the files at
foo/foo.swift
andfoo/bar/bar.swift
0 text files response
But instead get
i.e. the results for
foo/foo.swift
with onlyfoo/bar/bar.swift
filtered outAdditional context Actual result is the same as doing
cloc . --fullpath --not-match-d="bar"
. Expected result can be achieved by doingcloc . --fullpath --not-match-d="foo"
but for my actual real world use case I need to create a list of excludes i.e.cloc . --fullpath --not-match-d="/(root/example1|root/example2|root/example3)/"
such thatroot/example1/file.swift
would be excluded as well asroot/example1/subfolder/file.swift
This could just be a misunderstanding on how the regex works, as I've seen a number of other similar issues. However, I haven't found an answer that covers this case (AFAIK).