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
|
# Tweak gate configuration for our rally scenarios
|
||||||
function load_rc_for_rally {
|
function load_rc_for_rally {
|
||||||
for file in $(ls $RALLY_EXTRA_DIR/*.setup); do
|
for file in $(ls $RALLY_EXTRA_DIR/*.setup); do
|
||||||
local config=$(cat $file)
|
config=$(cat $file)
|
||||||
export DEVSTACK_LOCAL_CONFIG+="
|
export DEVSTACK_LOCAL_CONFIG+="
|
||||||
# generated from hook '$file'
|
# generated from hook '$file'
|
||||||
${config}
|
${config}
|
||||||
|
@ -20,8 +20,7 @@ function generate_testr_results {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
|
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]; then
|
||||||
then
|
|
||||||
owner=stack
|
owner=stack
|
||||||
sudo_env=
|
sudo_env=
|
||||||
|
|
||||||
|
13
run_tests.sh
13
run_tests.sh
@ -52,21 +52,21 @@ function process_options {
|
|||||||
-c|--coverage) coverage=1;;
|
-c|--coverage) coverage=1;;
|
||||||
-d|--debug) debug=1;;
|
-d|--debug) debug=1;;
|
||||||
--virtual-env-path)
|
--virtual-env-path)
|
||||||
(( i++ ))
|
$(( i++ ))
|
||||||
venv_path=${!i}
|
venv_path=${!i}
|
||||||
;;
|
;;
|
||||||
--virtual-env-name)
|
--virtual-env-name)
|
||||||
(( i++ ))
|
$(( i++ ))
|
||||||
venv_dir=${!i}
|
venv_dir=${!i}
|
||||||
;;
|
;;
|
||||||
--tools-path)
|
--tools-path)
|
||||||
(( i++ ))
|
$(( i++ ))
|
||||||
tools_path=${!i}
|
tools_path=${!i}
|
||||||
;;
|
;;
|
||||||
-*) testopts="$testopts ${!i}";;
|
-*) testopts="$testopts ${!i}";;
|
||||||
*) testargs="$testargs ${!i}"
|
*) testargs="$testargs ${!i}"
|
||||||
esac
|
esac
|
||||||
(( i++ ))
|
$(( i++ ))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ function run_pep8_changed {
|
|||||||
# --diff argument behaves surprisingly as well, because although you feed it a
|
# --diff argument behaves surprisingly as well, because although you feed it a
|
||||||
# diff, it actually checks the file on disk anyway.
|
# diff, it actually checks the file on disk anyway.
|
||||||
local target=${testargs:-HEAD~1}
|
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}"
|
echo "Running flake8 on ${files}"
|
||||||
warn_on_flake8_without_venv
|
warn_on_flake8_without_venv
|
||||||
diff -u --from-file /dev/null ${files} | ${wrapper} flake8 --diff
|
diff -u --from-file /dev/null ${files} | ${wrapper} flake8 --diff
|
||||||
@ -203,8 +203,7 @@ function run_pep8_changed {
|
|||||||
|
|
||||||
TESTRTESTS="python setup.py testr"
|
TESTRTESTS="python setup.py testr"
|
||||||
|
|
||||||
if [ $never_venv -eq 0 ]
|
if [ $never_venv -eq 0 ]; then
|
||||||
then
|
|
||||||
# Remove the virtual environment if --force used
|
# Remove the virtual environment if --force used
|
||||||
if [ $force -eq 1 ]; then
|
if [ $force -eq 1 ]; then
|
||||||
echo "Cleaning virtualenv..."
|
echo "Cleaning virtualenv..."
|
||||||
|
@ -22,3 +22,4 @@ reno>=1.8.0 # Apache-2.0
|
|||||||
# Needed to run DB commands in virtualenvs
|
# Needed to run DB commands in virtualenvs
|
||||||
PyMySQL>=0.7.6 # MIT License
|
PyMySQL>=0.7.6 # MIT License
|
||||||
tempest>=14.0.0 # Apache-2.0
|
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
|
neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration
|
||||||
python ./tools/list_moved_globals.py
|
python ./tools/list_moved_globals.py
|
||||||
{[testenv:genconfig]commands}
|
{[testenv:genconfig]commands}
|
||||||
|
{[testenv:bashate]commands}
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
sh
|
sh
|
||||||
bash
|
bash
|
||||||
@ -128,6 +129,17 @@ exclude = ./.*,build,dist
|
|||||||
import_exceptions = neutron._i18n
|
import_exceptions = neutron._i18n
|
||||||
local-check-factory = neutron.hacking.checks.factory
|
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]
|
[testenv:genconfig]
|
||||||
commands = {toxinidir}/tools/generate_config_file_samples.sh
|
commands = {toxinidir}/tools/generate_config_file_samples.sh
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user