Skip to content

Commit 6b25869

Browse files
authored
Merge pull request #70 from snowflake-app/lint-and-test
2 parents 3500d3b + 6daa7b6 commit 6b25869

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+853
-443
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.8
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.8
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip pipenv
21+
pipenv install --deploy --system --dev
22+
- name: Lint
23+
run: |
24+
make lint lint-tests

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
test: lint lint-tests
2+
pytest tests -v
3+
4+
lint-tests:
5+
mypy tests
6+
pylint --disable=duplicate-code tests
7+
8+
lint:
9+
mypy snowflake
10+
pylint snowflake

Pipfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ verify_ssl = true
55

66
[dev-packages]
77
pytest = "*"
8+
mypy = "*"
9+
pylint = "*"
10+
pylint-flask-sqlalchemy = "*"
811

912
[packages]
1013
flask = "*"

Pipfile.lock

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

mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
ignore_missing_imports=true

pylintrc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[MASTER]
2+
3+
fail-under = 10.0
4+
ignore = CVS
5+
6+
;jobs=0
7+
persistent = yes
8+
suggestion-mode = yes
9+
;
10+
11+
load-plugins =
12+
pylint_flask_sqlalchemy
13+
14+
disable =
15+
missing-module-docstring,
16+
missing-class-docstring,
17+
missing-function-docstring,
18+
too-few-public-methods
19+
20+
output-format = colorized
21+
22+
[DESIGN]
23+
max-parents = 15
24+
25+
[VARIABLES]
26+
init-import = no
27+
28+
[FORMAT]
29+
expected-line-ending-format = LF
30+
ignore-long-lines = ^\s*(# )?<?https?://\S+>?$
31+
indent-after-paren = 4
32+
indent-string = ' '
33+
max-line-length = 100
34+
max-module-lines = 1000
35+
single-line-class-stmt = no
36+
single-line-if-stmt = no
37+
38+
[BASIC]
39+
good-names = e,i,j,k,q,ex,id

snowflake/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from .app import app
2+
3+
__all__ = ['app']

snowflake/acl/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from .one_on_one import *
1+
from .one_on_one import can_view_one_on_one, can_delete_one_on_one
2+
3+
__all__ = ['can_view_one_on_one', 'can_delete_one_on_one']

snowflake/app.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from flask import Flask, url_for
44

55
from . import filters, settings, logger
6-
from .controllers import api, login, register, profile, index, one_on_one, appreciation, logout, notifications
6+
from .controllers import api, login, register, profile, index, one_on_one, appreciation, logout, \
7+
notifications
78
from .db import db
89
from .marshmallow import marshmallow
910
from .redis import redis
@@ -46,20 +47,17 @@
4647
@app.context_processor
4748
def setup():
4849
def entrypoint(file: str):
49-
with open(app.static_folder + "/assets/manifest.json") as f:
50-
manifest = json.load(f)
50+
with open(f"{app.static_folder}/assets/manifest.json") as manifest_file:
51+
manifest = json.load(manifest_file)
5152
chunk = manifest[file]
5253

5354
if app.debug:
5455
return 'http://localhost:8080/' + chunk
55-
else:
56-
return url_for('static', filename='assets/' + chunk)
56+
57+
return url_for('static', filename='assets/' + chunk)
5758

5859
def choose_plural(size, singular, plural):
59-
if size != 1:
60-
return plural
61-
else:
62-
return singular
60+
return plural if size != 1 else singular
6361

6462
return {
6563
'entrypoint': entrypoint,

snowflake/controllers/api/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
from . import one_on_ones
44
from . import token
55
from . import users
6+
7+
__all__ = [
8+
'healthcheck',
9+
'notifications',
10+
'one_on_ones',
11+
'token',
12+
'users',
13+
]

0 commit comments

Comments
 (0)