Skip to content

Commit 09246d5

Browse files
authored
Merge pull request #167 from peternewman/travis-fixes
Add codespell Travis check
2 parents b6fd7de + 013ecf3 commit 09246d5

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

.codespellignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(0x1BC0, "ALS Stanislaw Binkiewicz"),
2+
(0x030F, "Guangzhou Litewise Lighting Equipments Co., Ltd. dba \"EK Lights\""),

.travis-ci.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ elif [[ $TASK = 'spellintian' ]]; then
3535
else
3636
echo "Found $spellingerrors spelling errors"
3737
fi;
38+
elif [[ $TASK = 'codespell' ]]; then
39+
# run codespell only if it is the requested task
40+
spellingfiles=$(find ./ -type f -and ! \( \
41+
-wholename "./.git/*" -or \
42+
-wholename "./node_modules/*" \
43+
\) | xargs)
44+
# count the number of codespell errors
45+
spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[\\-'a-zA-Z0-9]+" --exclude-file .codespellignore $spellingfiles 2>&1 | wc -l)
46+
if [[ $spellingerrors -ne 0 ]]; then
47+
# print the output for info
48+
zrun codespell --check-filenames --quiet 2 --regex "[\\-'a-zA-Z0-9]+" --exclude-file .codespellignore $spellingfiles
49+
echo "Found $spellingerrors spelling errors via codespell"
50+
exit 1;
51+
else
52+
echo "Found $spellingerrors spelling errors via codespell"
53+
fi;
3854
elif [[ $TASK = 'flake8' ]]; then
3955
flake8 --max-line-length 80 --exclude .git,__pycache --ignore E111,E114,E129 $(find ./ -name "*.py" | xargs)
4056
#,E121,E127

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ install:
2020
- if [ "$TASK" = "flake8" ]; then pip install flake8; fi
2121
# If this causes SSL errors, then Sourceforge is probably in disaster recovery mode and needing Javascript. Could switch to a specific mirror, e.g. kent.dl.sourceforge.net
2222
- if [ "$TASK" = "pychecker" -o "$TASK" = "pychecker-wip" ]; then pip install http://sourceforge.net/projects/pychecker/files/pychecker/0.8.19/pychecker-0.8.19.tar.gz/download; fi
23+
- if [ "$TASK" = "codespell" ]; then pip install git+https://github.com/lucasdemarchi/codespell.git; fi
2324

2425
matrix:
2526
fast_finish: true
@@ -42,6 +43,15 @@ matrix:
4243
apt:
4344
packages:
4445
- moreutils
46+
- os: linux
47+
dist: trusty
48+
# Short duration job, use the container/without sudo image as it boots faster
49+
sudo: false
50+
env: TASK='codespell'
51+
addons:
52+
apt:
53+
packages:
54+
- moreutils
4555
- os: linux
4656
dist: trusty
4757
env: TASK='flake8'

admin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,14 @@ def DiffProperty(self, name, key, left_dict, right_dict):
655655
left = left_dict.get(key)
656656
right = right_dict.get(key)
657657
if left and right:
658-
left_formated, right_formatted = self._differ.Diff(str(left), str(right))
658+
left_formatted, right_formatted = self._differ.Diff(str(left), str(right))
659659
else:
660-
left_formated = left
660+
left_formatted = left
661661
right_formatted = right
662662
return {
663663
'name': name,
664664
'key': key,
665-
'left': left_formated,
665+
'left': left_formatted,
666666
'different': left != right,
667667
'prefer_left': left is not None and right is None,
668668
'prefer_right': right is not None and left is None,

model_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def UpdateResponder(self, manufacturer, model_info):
427427
"""Add or Update a Responder.
428428
429429
Returns:
430-
was_added, was_modifed
430+
was_added, was_modified
431431
"""
432432
was_added = False
433433
was_modified = False

0 commit comments

Comments
 (0)