scc handle .gitignore are unexpected
Describe the bug
scc handle .gitignore are not same as git.
To Reproduce
-
Different result between
clocandsccad-track on master via 🐹 v1.21.1 ❯ cloc --vcs=git --include-ext=go 186 text files. 181 unique files. 22 files ignored. github.com/AlDanial/cloc v 1.98 T=0.17 s (974.2 files/s, 83685.8 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Go 164 1696 1406 10986 ------------------------------------------------------------------------------- SUM: 164 1696 1406 10986 -------------------------------------------------------------------------------ad-track on master via 🐹 v1.21.1 ❯ scc -i go ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── Go 145 10607 1313 1139 8155 1046 ─────────────────────────────────────────────────────────────────────────────── Total 145 10607 1313 1139 8155 1046 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop (organic) $244,675 Estimated Schedule Effort (organic) 8.06 months Estimated People Required (organic) 2.70 ─────────────────────────────────────────────────────────────────────────────── Processed 318377 bytes, 0.318 megabytes (SI) ─────────────────────────────────────────────────────────────────────────────── -
But the sum of each sub directory is equal to
cloc. 131 + 94 + 10761 = 10986ad-track on master via 🐹 v1.21.1 ❯ for d in $(ls) ; do (scc $d -i go -c | grep Go); done Go 2 171 32 8 131 Go 2 129 21 14 94 Go 160 13790 1634 1395 10761 -
There is
log/*in.gitignore, when I removelog/*,sccresult are same ascloc. -
In sure, there are some sub directory named
login the project, but not in root.ad-track on master via 🐹 v1.21.1 ❯ tree -d -f | grep log │ │ └── ./pkg/handle/public/log │ │ ├── ./pkg/handle/zplus/log -
gitonly exclude the./log/*iflog/*be add to.gitignore, butsccexlude all*/log/*.
Expected behavior
scc shoulde have same behavior as git. In other words, scc should only exclude the ./log/* if log/* be add to .gitignore.
Desktop (please complete the following information):
- OS: macOS
- Version: 13.5.2 (22G91)
Yep aware. This is currently being worked on hence the creation of https://github.com/boyter/gocodewalker/
This is a good use case though, thanks for the excellent report.
I am pretty sure the above repo should walk correctly and respect things as expected.
Should work now as expected with the latest release.