forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinters.sh
More file actions
executable file
·58 lines (49 loc) · 1.47 KB
/
linters.sh
File metadata and controls
executable file
·58 lines (49 loc) · 1.47 KB
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
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
WORKSPACE="$(bazel info workspace)"
source "${WORKSPACE}/bin/use_bazel_go.sh"
cd ${WORKSPACE}
bazel ${BAZEL_STARTUP_ARGS} build ${BAZEL_RUN_ARGS} \
//... $(bazel query 'tests(//...)') @com_github_bazelbuild_buildtools//buildifier
buildifier="$(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier"
NUM_CPU=$(getconf _NPROCESSORS_ONLN)
bin/bazel_to_go.py
echo 'Running linters ....'
docker run\
-v $(bazel info output_base):$(bazel info output_base)\
-v $(pwd):/go/src/istio.io/istio\
-w /go/src/istio.io/istio\
gcr.io/istio-testing/linter:bfcc1d6942136fd86eb6f1a6fb328de8398fbd80\
--concurrency=4\
--enable-gc\
--vendored-linters\
--deadline=600s --disable-all\
--enable=aligncheck\
--enable=deadcode\
--enable=errcheck\
--enable=gas\
--enable=goconst\
--enable=gofmt\
--enable=goimports\
--enable=golint --min-confidence=0 \
--exclude=vendor/ --exclude=.pb.go --exclude="should have a package comment"\
--enable=ineffassign\
--enable=interfacer\
--enable=lll --line-length=160\
--enable=megacheck\
--enable=misspell\
--enable=structcheck\
--enable=unconvert\
--enable=varcheck\
--enable=vet\
--enable=vetshadow\
./...
echo 'linters OK'
echo 'Checking licences'
bin/check_license.sh
echo 'licences OK'
echo 'Running buildifier ...'
${buildifier} -showlog -mode=check $(git ls-files \
| grep -e 'BUILD' -e 'WORKSPACE' -e '.*\.bazel' -e '.*\.bzl' \
| grep -v vendor)
echo 'buildifer OK'