Add bashate tox command

Now that we copied the devstack code to our tree we need to ensure that
the bash scripts we have are correct. This patch is adding a tox command
(bashate) that will check the syntax of the shell scripts under
the devstack/ directory.

The scripts under devstack/tools/ are not being checked, that's because
they weren't check when the code was in devstack as well and there's
loads to fix. It will be fixed in a following patch.

Change-Id: I8f66492081e0fd10e1de057febb9324a81411c7a
Partial-Bug: #1526518
This commit is contained in:
Lucas Alvares Gomes 2015-12-15 20:00:20 +00:00
parent 3b9bc189f2
commit e95a8b9ae9

20
tox.ini
View File

@ -1,7 +1,7 @@
[tox]
minversion = 1.8
skipsdist = True
envlist = py34,py27,pep8
envlist = py34,py27,pep8,bashate
[testenv]
usedevelop = True
@ -62,6 +62,24 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
setenv = PYTHONHASHSEED=0
commands = {posargs}
[testenv:bashate]
deps =
{env:BASHATE_INSTALL_PATH:bashate==0.3.2}
whitelist_externals = bash
# TODO(lucasagomes): Check the tools/ directory as well
commands = bash -c "find {toxinidir}/devstack \
-not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs
-type f \ # only files
-not -name \*.swp \ # skip editor files
-not -name \*~ \ # skip editor files
-not -name \*.xml \ # skip xml files
-not -name \*.template \ # skip template files
\( \
-name \*.sh -or \ # add files eding with .sh
-wholename \*/lib/\* \ # add files under lib/
\) \
-print0 | xargs -0 bashate -v -iE006 -eE005,E042"
[flake8]
ignore = E129
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools