mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test: scan for exported godoc violations
This commit is contained in:
parent
67472d1ee0
commit
f6d8059ac1
@ -15,6 +15,11 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libpcap-dev
|
- libpcap-dev
|
||||||
|
- libaspell-dev
|
||||||
|
- libhunspell-dev
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- go get -v github.com/chzchzchz/goword
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./test
|
- ./test
|
||||||
|
12
test
12
test
@ -89,6 +89,18 @@ function fmt_tests {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Checking goword..."
|
||||||
|
# get all go files to process
|
||||||
|
gofiles=`find $FMT -iname '*.go' 2>/dev/null`
|
||||||
|
# ignore tests and protobuf files
|
||||||
|
gofiles=`echo ${gofiles} | sort | uniq | sed "s/ /\n/g" | egrep -v "(\\_test.go|\\.pb\\.go)"`
|
||||||
|
# only check for broken exported godocs
|
||||||
|
gowordRes=`goword -use-spell=false ${gofiles} | grep godoc-export | sort`
|
||||||
|
if [ ! -z "$gowordRes" ]; then
|
||||||
|
echo -e "goword checking failed:\n${gowordRes}"
|
||||||
|
exit 255
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Checking for license header..."
|
echo "Checking for license header..."
|
||||||
licRes=$(for file in $(find . -type f -iname '*.go' ! -path './Godeps/*'); do
|
licRes=$(for file in $(find . -type f -iname '*.go' ! -path './Godeps/*'); do
|
||||||
head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo -e " ${file}"
|
head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo -e " ${file}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user