aboutsummaryrefslogtreecommitdiff
path: root/.tool/lint
blob: 4ec8bf7ab0388481559a25b62406341d656232b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

# Create the linter path for use later
LINTER=${GOPATH}/bin/gometalinter

# Make sure gometalinter is installed
if [ ! -f ${LINTER} ]; then
	echo >&2 "gometalinter must be installed. Please run 'make install.tools' and try again"
	exit 1
fi

PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*' -a -not -iwholename './_output*')

echo $PKGS

# Execute the linter
${LINTER} \
	--concurrency=4\
	--enable-gc\
	--vendored-linters\
	--deadline=600s --disable-all\
	--enable=deadcode\
	--enable=errcheck\
	--enable=goconst\
	--enable=gofmt\
	--enable=golint\
	--enable=ineffassign\
	--enable=interfacer\
	--enable=megacheck\
	--enable=misspell\
	--enable=structcheck\
	--enable=varcheck\
	--enable=vet\
	--enable=vetshadow\
	--exclude='error return value not checked.*\(errcheck\)$'\
	--exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$'\
	--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$'\
	--exclude='duplicate of.*_test.go.*\(dupl\)$'\
	--exclude='cmd\/client\/.*\.go.*\(dupl\)$'\
	--exclude='vendor\/.*'\
	--exclude='kpod\/.*'\
	--exclude='server\/seccomp\/.*\.go.*$'\
	${PKGS[@]}