2 # source: https://github.com/openstack/neutron/blob/master/tools/coding-checks.sh
7 echo "Usage: $0 [OPTION]..."
8 echo "Run Yardstick's coding check(s)"
10 echo " -Y, --pylint [<basecommit>] Run pylint check on the entire neutron module or just files changed in basecommit (e.g. HEAD~1)"
11 echo " -h, --help Print this usage message"
18 while [ $i -le $# ]; do
22 -Y|--pylint) pylint=1;;
23 *) scriptargs="$scriptargs $opt"
30 local target="${scriptargs:-all}"
31 local output_format=""
33 if [ "$target" = "all" ]; then
34 files="ansible api tests yardstick"
37 *HEAD*|*HEAD~[0-9]*) files=$(git diff --diff-filter=AM --name-only $target -- "*.py");;
38 *) echo "$target is an unrecognized basecommit"; exit 1;;
41 # make Jenkins output parseable because Jenkins doesn't handle color
42 # enventually we should use the Jenkins Pylint plugin or other tools
43 if [ -n "${BRANCH:-}" ] ; then
44 output_format="--output-format=parseable"
46 echo "Running pylint..."
47 echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~0, this change only)..."
48 if [ -n "${files}" ]; then
49 pylint --rcfile=.pylintrc ${output_format} ${files}
51 echo "No python changes in this commit, pylint check not required."
61 if [ $pylint -eq 1 ]; then