Add bashate support
Bashate is a style checker program for bash scripts. This addition improves the quality of the current bash scripts and ensures that any future change will follow the same standards. Change-Id: Ia346f77632d4ac7beb288fa3aacea221d7969c87
This commit is contained in:
parent
d46636112f
commit
a14439549f
|
@ -39,7 +39,7 @@ ${config}
|
|||
# Tweak gate configuration for our rally scenarios
|
||||
function load_rc_for_rally {
|
||||
for file in $(ls $RALLY_EXTRA_DIR/*.setup); do
|
||||
local config=$(cat $file)
|
||||
config=$(cat $file)
|
||||
export DEVSTACK_LOCAL_CONFIG+="
|
||||
# generated from hook '$file'
|
||||
${config}
|
||||
|
|
|
@ -20,8 +20,7 @@ function generate_testr_results {
|
|||
fi
|
||||
}
|
||||
|
||||
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
|
||||
then
|
||||
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]; then
|
||||
owner=stack
|
||||
sudo_env=
|
||||
|
||||
|
|
13
run_tests.sh
13
run_tests.sh
|
@ -52,21 +52,21 @@ function process_options {
|
|||
-c|--coverage) coverage=1;;
|
||||
-d|--debug) debug=1;;
|
||||
--virtual-env-path)
|
||||
(( i++ ))
|
||||
$(( i++ ))
|
||||
venv_path=${!i}
|
||||
;;
|
||||
--virtual-env-name)
|
||||
(( i++ ))
|
||||
$(( i++ ))
|
||||
venv_dir=${!i}
|
||||
;;
|
||||
--tools-path)
|
||||
(( i++ ))
|
||||
$(( i++ ))
|
||||
tools_path=${!i}
|
||||
;;
|
||||
-*) testopts="$testopts ${!i}";;
|
||||
*) testargs="$testargs ${!i}"
|
||||
esac
|
||||
(( i++ ))
|
||||
$(( i++ ))
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ function run_pep8_changed {
|
|||
# --diff argument behaves surprisingly as well, because although you feed it a
|
||||
# diff, it actually checks the file on disk anyway.
|
||||
local target=${testargs:-HEAD~1}
|
||||
local files=$(git diff --name-only $target | tr '\n' ' ')
|
||||
files=$(git diff --name-only $target | tr '\n' ' ')
|
||||
echo "Running flake8 on ${files}"
|
||||
warn_on_flake8_without_venv
|
||||
diff -u --from-file /dev/null ${files} | ${wrapper} flake8 --diff
|
||||
|
@ -203,8 +203,7 @@ function run_pep8_changed {
|
|||
|
||||
TESTRTESTS="python setup.py testr"
|
||||
|
||||
if [ $never_venv -eq 0 ]
|
||||
then
|
||||
if [ $never_venv -eq 0 ]; then
|
||||
# Remove the virtual environment if --force used
|
||||
if [ $force -eq 1 ]; then
|
||||
echo "Cleaning virtualenv..."
|
||||
|
|
|
@ -22,3 +22,4 @@ reno>=1.8.0 # Apache-2.0
|
|||
# Needed to run DB commands in virtualenvs
|
||||
PyMySQL>=0.7.6 # MIT License
|
||||
tempest>=14.0.0 # Apache-2.0
|
||||
bashate>=0.2 # Apache-2.0
|
||||
|
|
12
tox.ini
12
tox.ini
|
@ -94,6 +94,7 @@ commands=
|
|||
neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration
|
||||
python ./tools/list_moved_globals.py
|
||||
{[testenv:genconfig]commands}
|
||||
{[testenv:bashate]commands}
|
||||
whitelist_externals =
|
||||
sh
|
||||
bash
|
||||
|
@ -128,6 +129,17 @@ exclude = ./.*,build,dist
|
|||
import_exceptions = neutron._i18n
|
||||
local-check-factory = neutron.hacking.checks.factory
|
||||
|
||||
[testenv:bashate]
|
||||
commands = bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .tox\* -prune \) \
|
||||
-not \( -type d -name .venv\* -prune \) \
|
||||
-type f \
|
||||
-name \*.sh \
|
||||
# E005 file does not begin with #! or have a .sh prefix
|
||||
# E006 check for lines longer than 79 columns
|
||||
# E042 local declaration hides errors
|
||||
-print0 | xargs -0 bashate -v -iE006 -eE005,E042"
|
||||
|
||||
[testenv:genconfig]
|
||||
commands = {toxinidir}/tools/generate_config_file_samples.sh
|
||||
|
||||
|
|
Loading…
Reference in New Issue