Skip to content

Commit 3bb06c3

Browse files
authored
Merge pull request #37 from vuLgAr/flake8
Flake8
2 parents ab56e62 + 7fe1cf7 commit 3bb06c3

File tree

9 files changed

+70
-6
lines changed

9 files changed

+70
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ install:
1414
- "pipenv install --dev"
1515

1616
script:
17+
- flake8 .
1718
- python manage.py cov

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,17 @@ With coverage:
7272
```sh
7373
$ python manage.py cov
7474
```
75+
76+
###
77+
78+
Run flake8 on the app:
79+
80+
```sh
81+
$ python manage.py flake
82+
```
83+
84+
or
85+
86+
```
87+
$ flake8 .
88+
```

{{cookiecutter.app_slug}}/Pipfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ flask-login = "*"
1414
flask-migrate = "*"
1515
flask-sqlalchemy = "*"
1616
flask-wtf = "*"
17+
configparser = "*"
1718

1819

1920
[dev-packages]
2021

2122
coverage = "*"
2223
flask-debugtoolbar = "*"
2324
flask-testing = "*"
25+
"flake8" = "*"
2426

2527

2628
[requires]

{{cookiecutter.app_slug}}/Pipfile.lock

Lines changed: 37 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

{{cookiecutter.app_slug}}/manage.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
import unittest
55

66
import coverage
7+
78
from flask.cli import FlaskGroup
89

910
from project.server import create_app, db
1011
from project.server.models import User
11-
12+
import subprocess
1213

1314
app = create_app()
1415
cli = FlaskGroup(create_app=create_app)
@@ -25,10 +26,12 @@
2526
)
2627
COV.start()
2728

29+
2830
@app.shell_context_processor
2931
def make_shell_context():
3032
return dict(app=app, db=db)
3133

34+
3235
@cli.command()
3336
def create_db():
3437
db.drop_all()
@@ -81,6 +84,11 @@ def cov():
8184
return 1
8285

8386

87+
@cli.command()
88+
def flake():
89+
"""Runs flake8 on the project."""
90+
subprocess.run(['flake8', '.'])
91+
8492

8593
if __name__ == '__main__':
8694
cli()

{{cookiecutter.app_slug}}/project/tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_index(self):
1313
response = self.client.get('/', follow_redirects=True)
1414
self.assertEqual(response.status_code, 200)
1515
self.assertIn(b'Welcome!', response.data)
16-
self.assertIn(b'Register/Login', response.data)
16+
self.assertIn(b'Login', response.data)
1717

1818
def test_about(self):
1919
# Ensure about route behaves correctly.

{{cookiecutter.app_slug}}/project/tests/test_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_validate_invalid_password(self):
9696
def test_register_route(self):
9797
# Ensure about route behaves correctly.
9898
response = self.client.get('/register', follow_redirects=True)
99-
self.assertIn(b'<h1>Please Register</h1>\n', response.data)
99+
self.assertIn(b'<h1>Register</h1>\n', response.data)
100100

101101
def test_user_registration(self):
102102
# Ensure registration behaves correctlys.

{{cookiecutter.app_slug}}/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
configparser==3.5.0
12
coverage==4.5.1
3+
flake8==3.5.0
24
Flask==0.12.2
35
Flask-Bcrypt==0.7.1
46
Flask-Bootstrap==3.3.7.1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length=79
3+
exclude=migrations

0 commit comments

Comments
 (0)