Add static code analysis to CI test (#1197)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Executable
+17
@@ -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
|
||||
Reference in New Issue
Block a user