Merge "Add jshint for javascript linting"

This commit is contained in:
Jenkins 2014-06-30 07:13:27 +00:00 committed by Gerrit Code Review
commit 3e9ba4f376
4 changed files with 30 additions and 0 deletions

View File

@ -165,6 +165,15 @@ For more detailed code analysis you can run::
The output will be saved in ``./pylint.txt``. The output will be saved in ``./pylint.txt``.
JsHint
------
For code analysis of JavaScript files::
./run_tests.sh --jshint
You need to have jshint installed before running the command.
Tab Characters Tab Characters
-------------- --------------

View File

@ -28,6 +28,7 @@ function usage {
echo " -P, --no-pep8 Don't run pep8 by default" echo " -P, --no-pep8 Don't run pep8 by default"
echo " -t, --tabs Check for tab characters in files." echo " -t, --tabs Check for tab characters in files."
echo " -y, --pylint Just run pylint" echo " -y, --pylint Just run pylint"
echo " -j, --jshint Just run jshint"
echo " -q, --quiet Run non-interactively. (Relatively) quiet." echo " -q, --quiet Run non-interactively. (Relatively) quiet."
echo " Implies -V if -N is not set." echo " Implies -V if -N is not set."
echo " --only-selenium Run only the Selenium unit tests" echo " --only-selenium Run only the Selenium unit tests"
@ -67,6 +68,7 @@ no_pep8=0
just_pylint=0 just_pylint=0
just_docs=0 just_docs=0
just_tabs=0 just_tabs=0
just_jshint=0
never_venv=0 never_venv=0
quiet=0 quiet=0
restore_env=0 restore_env=0
@ -98,6 +100,7 @@ function process_option {
-p|--pep8) just_pep8=1;; -p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;; -P|--no-pep8) no_pep8=1;;
-y|--pylint) just_pylint=1;; -y|--pylint) just_pylint=1;;
-j|--jshint) just_jshint=1;;
-f|--force) force=1;; -f|--force) force=1;;
-t|--tabs) just_tabs=1;; -t|--tabs) just_tabs=1;;
-q|--quiet) quiet=1;; -q|--quiet) quiet=1;;
@ -142,6 +145,12 @@ function run_pylint {
fi fi
} }
function run_jshint {
echo "Running jshint ..."
jshint horizon/static/horizon/js
jshint horizon/static/horizon/tests
}
function run_pep8 { function run_pep8 {
echo "Running flake8 ..." echo "Running flake8 ..."
set +o errexit set +o errexit
@ -481,6 +490,12 @@ if [ $just_pylint -eq 1 ]; then
exit $? exit $?
fi fi
# Jshint
if [ $just_jshint -eq 1 ]; then
run_jshint
exit $?
fi
# Tab checker # Tab checker
if [ $just_tabs -eq 1 ]; then if [ $just_tabs -eq 1 ]; then
tab_check tab_check

View File

@ -3,6 +3,7 @@ django-nose
docutils==0.9.1 docutils==0.9.1
hacking>=0.8.0,<0.9 hacking>=0.8.0,<0.9
mox>=0.5.3 mox>=0.5.3
nodeenv>=0.9.4
nose nose
nose-exclude nose-exclude
nosehtmloutput>=0.0.3 nosehtmloutput>=0.0.3

View File

@ -44,6 +44,11 @@ commands = /bin/bash run_tests.sh -N --integration {posargs}
basepython = python2.6 basepython = python2.6
commands = /bin/bash run_tests.sh -N --integration {posargs} commands = /bin/bash run_tests.sh -N --integration {posargs}
[testenv:jshint]
commands = nodeenv -p
npm install jshint -g
/bin/bash run_tests.sh -N --jshint
[testenv:docs] [testenv:docs]
setenv = DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings setenv = DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
commands = python setup.py build_sphinx commands = python setup.py build_sphinx