Fix issues found by bashate and include in gating

Cleanup shell scripts to pass bashate testing.
Add bashate check to pep8 check target.

Change-Id: I49b9ab1e352378a43f82a4e1f5db02a8dae99d27
This commit is contained in:
Andreas Jaeger 2014-08-16 14:54:22 +02:00
parent 175e79ebf7
commit 94849df097
6 changed files with 41 additions and 23 deletions

View File

@ -1,27 +1,34 @@
#!/bin/bash -ex
# Documentation can be submitted in markdown and then converted to docbook
# so it can be built with the maven plugin. This is used by Jenkins when
# invoking certain docs jobs and the resulting output is made available to maven.
# Documentation can be submitted in markdown and then converted to
# docbook so it can be built with the maven plugin. This is used by
# Jenkins when invoking certain docs jobs and the resulting output is
# made available to maven.
# In case we start doing something more sophisticated with other refs
# later (such as tags).
BRANCH=$ZUUL_REFNAME
shopt -s extglob
# This function figures out the location of the original script (as opposed to any chain of
# symlinks pointing to it). Source:
# This function figures out the location of the original script (as
# opposed to any chain of symlinks pointing to it). Source:
# http://muffinresearch.co.uk/archives/2008/10/10/bash-resolving-symlinks-to-shellscripts/
function resolve_symlink {
SCRIPT=$1 NEWSCRIPT=''
until [ "$SCRIPT" = "$NEWSCRIPT" ]; do
if [ "${SCRIPT:0:1}" = '.' ]; then SCRIPT=$PWD/$SCRIPT; fi
if [ "${SCRIPT:0:1}" = '.' ]; then
SCRIPT=$PWD/$SCRIPT;
fi
cd $(dirname $SCRIPT)
if [ ! "${SCRIPT:0:1}" = '.' ]; then SCRIPT=$(basename $SCRIPT); fi
if [ ! "${SCRIPT:0:1}" = '.' ]; then
SCRIPT=$(basename $SCRIPT);
fi
SCRIPT=${NEWSCRIPT:=$SCRIPT}
NEWSCRIPT=$(ls -l $SCRIPT | awk '{ print $NF }')
done
if [ ! "${SCRIPT:0:1}" = '/' ]; then SCRIPT=$PWD/$SCRIPT; fi
if [ ! "${SCRIPT:0:1}" = '/' ]; then
SCRIPT=$PWD/$SCRIPT;
fi
echo $(dirname $SCRIPT)
}
DIR=$(resolve_symlink $0)
@ -36,10 +43,12 @@ else
exit 1
fi
# Need to get the file name to insert here so it can be reused for multiple projects
# Filenames for the known repos that could do this are openstackapi-programming.mdown
# and images-api-v2.0.md and openstackapi-programming and images-api-v2.0 are the names
# for the ID and xml filename.
# Need to get the file name to insert here so it can be reused for
# multiple projects Filenames for the known repos that could do this
# are openstackapi-programming.mdown and images-api-v2.0.md and
# openstackapi-programming and images-api-v2.0 are the names for the
# ID and xml filename.
FILENAME=$1
FILEPATH=`find ./ -regextype posix-extended -regex ".*${FILENAME}\.(md|markdown|mdown)"`
DIRPATH=`dirname $FILEPATH`

View File

@ -1,3 +1,4 @@
bashate >= 0.2
doc8
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.9.2,<0.10

View File

@ -18,6 +18,14 @@ commands =
# HACKING.rst is the only file that is not referenced from
# doc/source, so add it explicitely.
doc8 -e txt -e rst doc/source/ HACKING.rst
# Run bashate during pep8 runs to ensure violations are caught by
# the check and gate queues.
bashate autogenerate_config_docs/autohelp-wrapper \
autogenerate_config_docs/test/genconfs.sh \
bin/doc-tools-check-languages \
build_environment/files/fetch.sh build_environment/bin/package.sh \
cleanup/remove_trailing_whitespaces.sh \
os_doc_tools/scripts/markdown-docbook.sh
[testenv:pylint]
commands = pylint os_doc_tools cleanup