Skip to content

Commit 5f2edd7

Browse files
committed
Add travis job
Launch pylint with pylint-django plugins At this time, only report Warnings and Errors Remove mysql dependencies because default configuration use sqlite, we should add dedicated howto to enable it. Fix error in exportbooks command. Disable pylint for no-member for save method for FileField (check pylint-dev/pylint-django#60)
1 parent 8051fdc commit 5f2edd7

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
langague: python
2+
distr: trusty
3+
sudo: required
4+
python:
5+
- 2.7
6+
7+
before_install:
8+
- sudo apt-get install -y python-virtualenv
9+
- virtualenv /tmp/venv
10+
- source /tmp/venv/bin/activate
11+
- pip install -r requirements.pip
12+
- pip install -r test-requirements.pip
13+
14+
script:
15+
- scripts/run-pylint.sh

books/management/commands/exportbooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _handle_csv(self, csvpath):
6060
'a_author': book.a_author.a_author.encode('utf-8'),
6161
'a_summary': book.a_summary.encode('utf-8')}
6262
writer.writerow(entry)
63-
writer.close()
63+
csvfile.close()
6464

6565

6666
def handle(self, filepath='', *args, **options):

books/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def save(self, *args, **kwargs):
140140
cover_path = epub_file.get_cover_image_path()
141141
if cover_path is not None and os.path.exists(cover_path):
142142
cover_file = File(open(cover_path))
143-
self.cover_img.save(os.path.basename(cover_path),
143+
self.cover_img.save(os.path.basename(cover_path), # pylint: disable=no-member
144144
cover_file)
145145
epub_file.close()
146146

requirements.pip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Django==1.4.5
22
django-tagging==0.3.1
33
django-sendfile==0.3.6
4-
MySQL-python>=1.2.3
54
lxml==3.4.4
65
django-taggit==0.14.0

scripts/run-pylint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
for file in $(git ls-files -- '*.py' | grep -vE 'deploy|fabfile'); do
4+
echo "==== $file"
5+
pylint --rcfile=pylintrc --load-plugins pylint_django --score=no --reports=no --disable=R,C $file
6+
RET=$? # pylint returns bitfield of found issues
7+
ERR=$(($RET&3)) # Fatal is 1 and Error is 2
8+
if [[ $ERR -ne 0 ]]; then
9+
echo "Aborting"
10+
exit 1
11+
fi
12+
done
13+
14+
exit 0

test-requirements.pip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pylint==1.7.1
2+
pylint-django==0.7.2

0 commit comments

Comments
 (0)