Skip to content

Commit

Permalink
Merge "Establish baseline JSCS configuration"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed May 1, 2015
2 parents 49ceaa0 + 97db368 commit f0786bd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"disallowTrailingWhitespace": true
}
7 changes: 7 additions & 0 deletions doc/source/ref/run_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------

Expand Down
18 changes: 18 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f0786bd

Please sign in to comment.