summaryrefslogtreecommitdiff
path: root/run_tests.sh
diff options
context:
space:
mode:
authorMichael Krotscheck <krotscheck@gmail.com>2015-06-16 10:27:59 -0700
committerShaoquan Chen <sean.chen2@hp.com>2015-06-30 23:00:29 -0700
commitc6c0352982391b37c265e49994195f55f4b02781 (patch)
treeba2693f5c9a3243bf55e30529ac90770cd66176d /run_tests.sh
parente217e041d43f2c8668f07b857747271b1a16943c (diff)
downloadhorizon-c6c0352982391b37c265e49994195f55f4b02781.tar.gz
Switched from JSCS to ESLint
This patch switches horizon from using JSCS to using ESlint. It adds the john papa style guides as an eslint plugin, and deactivates additional linting rules so current cleanup efforts can focus on the issues remaining from JSCS. Once that cleanup effort is complete, we can switch our linting job to voting and move forward from there. YAML for .eslintrc was chosen because the JSON specification does not allow comments, and having comments (including rule links) will make it easier to discuss linting changes. Deactivated eslint rules have each been annotated with a # TODO statement, so we can address them in the future. Links in the documentation have been updated to new contributor guidelines, which will be updated after this patch lands. Linting may be executed by first installing npm dependencies using `npm install`, and then executing `npm run lint` at any time in the future. No python venv is required. For clarification: We are switching to ESLint because JSCS explicitly focuses on code-style, not on language use errors. For that purpose, JSCS explicitly defers to JSHint, which due to the 'do no evil' license is not usable. Since ESLint provides both the codestyle functionality, and the language use checks, of both JSCS and JSHint, it was deemed the only viable tool, http://lists.openstack.org/pipermail/openstack-dev/2015-June/067030.html Change-Id: Ib4c3f77f8cc3cdaa3c7558b7bc3a6d1299b6dcbe Partially-Implements: blueprint jscs-cleanup
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/run_tests.sh b/run_tests.sh
index ca7016603..964252056 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -27,7 +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 " -e, --eslint Just run eslint"
echo " -k, --karma Just run karma"
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
echo " Implies -V if -N is not set."
@@ -71,7 +71,7 @@ no_pep8=0
just_pylint=0
just_docs=0
just_tabs=0
-just_jscs=0
+just_eslint=0
just_jshint=0
just_karma=0
never_venv=0
@@ -110,7 +110,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;;
+ -e|--eslint) just_eslint=1;;
-k|--karma) just_karma=1;;
-f|--force) force=1;;
-t|--tabs) just_tabs=1;;
@@ -167,13 +167,13 @@ 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"
+function run_eslint {
+ echo "Running eslint ..."
+ if [ "`which npm`" == '' ] ; then
+ echo "npm is not present; please install, e.g. sudo apt-get install npm"
else
- jscs horizon/static/horizon/js horizon/static/horizon/tests \
- horizon/static/framework/ openstack_dashboard/static/dashboard/
+ npm install
+ npm run lint
fi
}
@@ -589,9 +589,9 @@ if [ $just_jshint -eq 1 ]; then
exit $?
fi
-# Jscs
-if [ $just_jscs -eq 1 ]; then
- run_jscs
+# ESLint
+if [ $just_eslint -eq 1 ]; then
+ run_eslint
exit $?
fi