Skip to content

Commit 86bc3b3

Browse files
committed
Enabling a linter.
1 parent 799c717 commit 86bc3b3

7 files changed

+51
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
tools/*
99
.testrepository
1010
*.png
11+
web-animations-4lint.js

.travis-run.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#! /bin/bash
2+
3+
set -x
4+
5+
if [ x$MODE == x'check' ]; then
6+
SUCCESS=0
7+
8+
# Check that the testcases json file has been updated
9+
echo "Checking test cases is up to date..."
10+
python ./test/update-testcases.py --dry-run
11+
let "SUCCESS += $?"
12+
13+
# Check that the web-animations.js file passes lint checks
14+
./run-lint.sh
15+
let "SUCCESS += $?"
16+
17+
exit $SUCCESS
18+
else
19+
# For pull requests we don't have access to secure environment variables, so we just return true.
20+
if [ x$BROWSER == "xRemote" -a x$SAUCE_ACCESS_KEY == x"" ]; then
21+
exit 0
22+
fi
23+
24+
echo ./run-tests.sh $ARGS | bash || exit 1
25+
fi

.travis-setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /bin/sh
1+
#! /bin/bash
22

33
set -x
44

.travis.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ env:
77
- SAUCE_USERNAME=mithro
88

99
matrix:
10+
- MODE='check'
1011
- BROWSER=Chrome-stable ARGS='-x -b Chrome -u'
1112
- BROWSER=Chrome-beta ARGS='-x -b Chrome -u'
1213
- BROWSER=Chrome-unstable ARGS='-x -b Chrome -u'
@@ -29,13 +30,7 @@ install:
2930
- ./.travis-setup.sh
3031

3132
script:
32-
- python ./test/update-testcases.py --dry-run || (echo "Please run update-testcases!"; false)
33-
# For pull requests we don't have access to secure environment variables, so we just return true.
34-
- if [ x$BROWSER == "xRemote" -a x$SAUCE_ACCESS_KEY == "x" ]; then
35-
true;
36-
else
37-
echo ./run-tests.sh $ARGS | bash;
38-
fi
33+
- ./.travis-run.sh
3934

4035
after_failure:
4136
- for file in *.log; do echo $file; echo "======================"; cat $file; done || true

run-lint.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash
2+
3+
# Update git submodules
4+
git submodule init
5+
git submodule update
6+
7+
# If already in a VIRTUAL_ENV assume the person knows what they are doing,
8+
# otherwise set up a python virtualenv with all the needed requirements.
9+
if [ x$VIRTUAL_ENV == x"" ]; then
10+
cd tools/python
11+
source setup.sh
12+
cd ../..
13+
fi
14+
15+
# Comment out the (function() {} ) wrapper
16+
sed -e'17s-^-//-' -e'$s-^-//-' web-animations.js > web-animations-4lint.js
17+
18+
gjslint --summary --nojsdoc --strict web-animations-4lint.js
19+
exit $?

run-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ if [ x$VIRTUAL_ENV == x"" ]; then
1212
cd ../..
1313
fi
1414

15-
exec python tools/python/run-tests.py $@
15+
exec python tools/python/run-tests.py "$@"

tools/python/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ testtools>=0.9.30
22
python-subunit # subunit
33
selenium
44

5+
-e svn+http://closure-linter.googlecode.com/svn/trunk/#egg=closer-linter
6+
57
# Requirements for using -x
68
pyvirtualdisplay
79
pyscreenshot

0 commit comments

Comments
 (0)