Add static code analysis to CI test (#1197)

This commit is contained in:
Ta-Ching Chen
2019-06-02 14:29:38 +08:00
committed by GitHub
parent 1562cba420
commit 93d4f2c77a
23 changed files with 130 additions and 146 deletions
+16 -3
View File
@@ -6,6 +6,22 @@
set -e
TOOL_DIR=$HOME/tool
if [ ! -d $TOOL_DIR ]
then
mkdir -p $TOOL_DIR
fi
# Get staticcheck
STATICCHECK_VERSION=2019.1.1
if [ ! -f $TOOL_DIR/staticcheck ]
then
curl -LO https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64
chmod +x staticcheck_linux_amd64
mv staticcheck_linux_amd64 $TOOL_DIR/staticcheck
fi
K8SCLI_DIR=$HOME/k8scli
if [ ! -d $K8SCLI_DIR ]
@@ -52,9 +68,6 @@ then
curl https://sdk.cloud.google.com | bash
fi
# gcloud command
export PATH=${HOME}/google-cloud-sdk/bin:${PATH}
# ensure we have the gcloud binary
gcloud version
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
ROOT=`realpath $(dirname $0)/..`
# Currently here only lists the packages that already addressed all warnings for gradual code repair.
# That means we don't allow adding new warnings to any of package in list. And eventually, the
# list will be replaced by find command.
declare -a pkgs=("pkg/builder" "pkg/builder" "pkg/crd" "pkg/logger" "pkg/buildermgr" "pkg/fission-cli" "cmd/fission-cli")
for pkg in "${pkgs[@]}"
do
find ${ROOT}/${pkg} -type d |grep -v influxdb | xargs -I@ staticcheck @
done