Skip to content

Commit 48e7e21

Browse files
authored
Make "--exclude-dir" support multi-level dirs (#572)
Fix #564. Upgrade modules.
1 parent 6d92d43 commit 48e7e21

File tree

15 files changed

+329
-234
lines changed

15 files changed

+329
-234
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("test for issue 564")

examples/issue564/b/c/level2/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("test for issue 564")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("test for issue 564")

examples/issue564/level1/test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package main
2+
3+
func main() {}

examples/issue564/test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package main
2+
3+
func main() {}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module github.com/boyter/scc/v3
33
go 1.22
44

55
require (
6-
github.com/boyter/gocodewalker v1.3.5
6+
github.com/boyter/gocodewalker v1.4.0
77
github.com/json-iterator/go v1.1.12
8-
github.com/mattn/go-runewidth v0.0.15
8+
github.com/mattn/go-runewidth v0.0.16
99
github.com/rs/zerolog v1.30.0
1010
github.com/spf13/cobra v1.8.1
11-
golang.org/x/crypto v0.31.0
11+
golang.org/x/crypto v0.32.0
1212
golang.org/x/text v0.21.0
1313
gopkg.in/yaml.v2 v2.4.0
1414
)
@@ -23,5 +23,5 @@ require (
2323
github.com/rivo/uniseg v0.4.7 // indirect
2424
github.com/spf13/pflag v1.0.5 // indirect
2525
golang.org/x/sync v0.10.0 // indirect
26-
golang.org/x/sys v0.28.0 // indirect
26+
golang.org/x/sys v0.29.0 // indirect
2727
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/boyter/gocodewalker v1.3.5 h1:0FIqU/EGscYzDG9o9770CRhb0esbaDeiaBEYZ4dSCpg=
2-
github.com/boyter/gocodewalker v1.3.5/go.mod h1:hXG8xzR1uURS+99P5/3xh3uWHjaV2XfoMMmvPyhrCDg=
1+
github.com/boyter/gocodewalker v1.4.0 h1:fVmFeQxKpj5tlpjPcyTtJ96btgaHYd9yn6m+T/66et4=
2+
github.com/boyter/gocodewalker v1.4.0/go.mod h1:hXG8xzR1uURS+99P5/3xh3uWHjaV2XfoMMmvPyhrCDg=
33
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
44
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
55
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
@@ -20,8 +20,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
2020
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
2121
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
2222
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
23-
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
24-
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
23+
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
24+
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
2525
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
2626
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
2727
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -44,16 +44,16 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
4444
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4545
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
4646
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
47-
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
48-
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
47+
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
48+
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
4949
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
5050
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
5151
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5252
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5353
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5454
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
55-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
56-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
55+
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
56+
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
5757
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
5858
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
5959
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

test-all.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,59 @@ else
10811081
echo -e "${GREEN}PASSED Issue379 Regression Check"
10821082
fi
10831083

1084+
# Regression tests for https://github.com/boyter/scc/issues/564
1085+
Issue564GoCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore | grep 'Go' | cut -d ',' -f 8)
1086+
Issue564PyCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore | grep 'Python' | cut -d ',' -f 8)
1087+
Issue564GoExcludeCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level2 | grep 'Go' | cut -d ',' -f 8)
1088+
Issue564PyExcludeCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level2 | grep 'Python' | cut -d ',' -f 8)
1089+
Issue564GoExclude2Count=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level1 | grep 'Go' | cut -d ',' -f 8)
1090+
Issue564PyExclude2Count=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level1 | grep 'Python' | cut -d ',' -f 8)
1091+
Issue564GoExcludeMultiCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level1/level2 | grep 'Go' | cut -d ',' -f 8)
1092+
Issue564PyExcludeMultiCount=$(./scc -f csv "examples/issue564/" --no-scc-ignore --exclude-dir=level1/level2 | grep 'Python' | cut -d ',' -f 8)
1093+
if [ $Issue564GoCount -ne 2 ] ; then
1094+
echo -e "${RED}======================================================="
1095+
echo -e "FAILED Issue564 Go file counting"
1096+
echo -e "=======================================================${NC}"
1097+
exit
1098+
elif [ $Issue564PyCount -ne 3 ] ; then
1099+
echo -e "${RED}======================================================="
1100+
echo -e "FAILED Issue564 Python file counting"
1101+
echo -e "=======================================================${NC}"
1102+
exit
1103+
elif [ "$Issue564PyExcludeCount" != "" ] ; then
1104+
echo -e "${RED}======================================================="
1105+
echo -e "FAILED Issue564 exclude level2 Python file counting"
1106+
echo -e "=======================================================${NC}"
1107+
exit
1108+
elif [ $Issue564GoExcludeCount -ne 2 ] ; then
1109+
echo -e "${RED}======================================================="
1110+
echo -e "FAILED Issue564 exclude level2 Go file counting"
1111+
echo -e "=======================================================${NC}"
1112+
exit
1113+
elif [ $Issue564PyExclude2Count -ne 1 ] ; then
1114+
echo -e "${RED}======================================================="
1115+
echo -e "FAILED Issue564 exclude level1 Python file counting"
1116+
echo -e "=======================================================${NC}"
1117+
exit
1118+
elif [ $Issue564GoExclude2Count -ne 1 ] ; then
1119+
echo -e "${RED}======================================================="
1120+
echo -e "FAILED Issue564 exclude level1 Go file counting"
1121+
echo -e "=======================================================${NC}"
1122+
exit
1123+
elif [ $Issue564GoExcludeMultiCount -ne 2 ] ; then
1124+
echo -e "${RED}======================================================="
1125+
echo -e "FAILED Issue564 exclude level1/level2 Go file counting"
1126+
echo -e "=======================================================${NC}"
1127+
exit
1128+
elif [ $Issue564PyExcludeMultiCount -ne 1 ] ; then
1129+
echo -e "${RED}======================================================="
1130+
echo -e "FAILED Issue564 exclude level1/level2 Python file counting"
1131+
echo -e "=======================================================${NC}"
1132+
exit
1133+
else
1134+
echo -e "${GREEN}PASSED Issue564 Regression Check"
1135+
fi
1136+
10841137
# Extra case for longer languages that are normally truncated
10851138
for i in 'CloudFormation (YAM' 'CloudFormation (JSO'
10861139
do

vendor/github.com/boyter/gocodewalker/Makefile

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/boyter/gocodewalker/check.sh

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)