diff options
-rw-r--r-- | .travis.yml | 6 | ||||
-rwxr-xr-x | tools/grep_avoided_functions.sh | 27 |
2 files changed, 31 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 4ee2755b..d286c2ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -174,11 +174,13 @@ matrix: env: - TEST=bgp_confederation_test.py # -# Spell Check +# Tools # - <<: *_python install: pip install scspell3k - script: bash tools/spell-check/scspell.sh + script: + - bash tools/spell-check/scspell.sh + - bash tools/grep_avoided_functions.sh cache: pip: true diff --git a/tools/grep_avoided_functions.sh b/tools/grep_avoided_functions.sh new file mode 100755 index 00000000..d5b6494b --- /dev/null +++ b/tools/grep_avoided_functions.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# List of functions which should not be used with remarkable reasons +FUNCS=( +# On a 32-bit platform, int type is not big enough to convert into uint32 type. +# strconv.Atoi() should be replaced by strconv.ParseUint() or +# strconv.ParseInt(). +'strconv\.Atoi' +) + +SCRIPT_DIR=`dirname $0` + +RESULT=0 + +for FUNC in ${FUNCS[@]} +do + for GO_PKG in $(go list github.com/osrg/gobgp/... | grep -v '/vendor/') + do + grep ${FUNC} -r ${GOPATH}/src/${GO_PKG} + if [ $? -ne 1 ] + then + RESULT=1 + fi + done +done + +exit $RESULT
\ No newline at end of file |