-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis-ci.sh
42 lines (40 loc) · 1.59 KB
/
.travis-ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
if [[ $TASK = 'npm-test' ]]; then
npm test
elif [[ $TASK = 'spellintian' ]]; then
# run the spellchecker only if it is the requested task
spellingfiles=$(find ./ -type f -and ! \( \
-wholename "./.git/*" -or \
-wholename "./node_modules/*" \
\) | xargs)
# count the number of spellchecker errors
spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | \
wc -l)
if [[ $spellingerrors -ne 0 ]]; then
# print the output for info
zrun spellintian $spellingfiles
echo "Found $spellingerrors spelling errors"
exit 1;
else
echo "Found $spellingerrors spelling errors"
fi;
elif [[ $TASK = 'codespell' ]]; then
# run codespell only if it is the requested task
spellingfiles=$(find ./ -type f -and ! \( \
-wholename "./.git/*" -or \
-wholename "./node_modules/*" \
\) | xargs)
# count the number of codespell errors
spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l)
if [[ $spellingerrors -ne 0 ]]; then
# print the output for info
zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles
echo "Found $spellingerrors spelling errors via codespell"
exit 1;
else
echo "Found $spellingerrors spelling errors via codespell"
fi;
elif [[ $TASK = 'jsonschemalinter' ]]; then
# run jsonschemalinter only if it is the requested task
curl -X POST https://www.json-schema-linter.com/api/jsonschemalinter/analyze -H "Content-Type: application/json" --data-binary "@schema.json"
fi