Establish baseline JSCS configuration
Establishes the ability to have JSCS (JS Code Style) run from the run_tests.sh script. Also provides basis for code style configuration. Co-Authored-By: Brian Tully <brian.tully@hp.com> Change-Id: Ib22da5ae05c353d12507a1809ec79e93379acecf Closes-Bug: 1450626
This commit is contained in:
parent
c6b2bc7e22
commit
97db36822e
@ -140,6 +140,13 @@ Give me metrics!
|
||||
You can generate various reports and metrics using command line arguments
|
||||
to ``run_tests.sh``.
|
||||
|
||||
JSCS
|
||||
----
|
||||
|
||||
To run JSCS, a JavaScript code style checker::
|
||||
|
||||
./run_tests.sh --jscs
|
||||
|
||||
Coverage
|
||||
--------
|
||||
|
||||
|
18
run_tests.sh
18
run_tests.sh
@ -27,6 +27,7 @@ function usage {
|
||||
echo " -t, --tabs Check for tab characters in files."
|
||||
echo " -y, --pylint Just run pylint"
|
||||
echo " -j, --jshint Just run jshint"
|
||||
echo " -s, --jscs Just run jscs"
|
||||
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
|
||||
echo " Implies -V if -N is not set."
|
||||
echo " --only-selenium Run only the Selenium unit tests"
|
||||
@ -106,6 +107,7 @@ function process_option {
|
||||
-P|--no-pep8) no_pep8=1;;
|
||||
-y|--pylint) just_pylint=1;;
|
||||
-j|--jshint) just_jshint=1;;
|
||||
-s|--jscs) just_jscs=1;;
|
||||
-f|--force) force=1;;
|
||||
-t|--tabs) just_tabs=1;;
|
||||
-q|--quiet) quiet=1;;
|
||||
@ -161,6 +163,16 @@ function run_jshint {
|
||||
jshint openstack_dashboard/static/dashboard/
|
||||
}
|
||||
|
||||
function run_jscs {
|
||||
echo "Running jscs ..."
|
||||
if [ "`which jscs`" == '' ] ; then
|
||||
echo "jscs is not present; please install, e.g. sudo npm install jscs -g"
|
||||
else
|
||||
jscs horizon/static/horizon/js horizon/static/horizon/tests \
|
||||
horizon/static/angular/ openstack_dashboard/static/dashboard/
|
||||
fi
|
||||
}
|
||||
|
||||
function warn_on_flake8_without_venv {
|
||||
set +o errexit
|
||||
${command_wrapper} python -c "import hacking" 2>/dev/null
|
||||
@ -555,6 +567,12 @@ if [ $just_jshint -eq 1 ]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Jscs
|
||||
if [ $just_jscs -eq 1 ]; then
|
||||
run_jscs
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Tab checker
|
||||
if [ $just_tabs -eq 1 ]; then
|
||||
tab_check
|
||||
|
5
tox.ini
5
tox.ini
@ -49,6 +49,11 @@ commands = nodeenv -p
|
||||
npm install jshint -g
|
||||
/bin/bash run_tests.sh -N --jshint
|
||||
|
||||
[testenv:jscs]
|
||||
commands = nodeenv -p
|
||||
npm install jscs -g
|
||||
/bin/bash run_tests.sh -N --jscs
|
||||
|
||||
[testenv:docs]
|
||||
setenv = DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
|
||||
commands = python setup.py build_sphinx
|
||||
|
Loading…
x
Reference in New Issue
Block a user