Skip to content

Commit bfb3af4

Browse files
ediskandarov-curkhamaileon
authored andcommitted
Add flake8 to CI checks (Kludex#157)
* ➕ add flake8 requirement for linting * 👷 add flake8 to lint script * 🚨 fix linter warnings * 👷 add scripts/lint to github test workflow
1 parent cd887f0 commit bfb3af4

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ jobs:
3131
- name: Run tests
3232
run: |
3333
scripts/test
34+
- name: Run linters
35+
run: |
36+
scripts/lint
3437
- name: Run codecov
3538
run: codecov

mangum/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .adapter import Mangum
1+
from .adapter import Mangum # noqa: F401

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pytest
33
codecov
44
pytest-cov
55
black
6+
flake8
67
starlette
78
quart; python_version == '3.7'
89
moto
@@ -11,4 +12,4 @@ brotli
1112
brotli-asgi
1213
# Docs
1314
mkdocs
14-
mkdocs-material
15+
mkdocs-material

scripts/lint

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ fi
88
set -x
99

1010
${PREFIX}black mangum tests --check
11-
${PREFIX}mypy mangum --disallow-untyped-defs --ignore-missing-imports
11+
${PREFIX}mypy mangum --disallow-untyped-defs --ignore-missing-imports
12+
${PREFIX}flake8 mangum tests

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def mock_http_event(request):
1010
"path": "/test/hello",
1111
"body": body,
1212
"headers": {
13-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
13+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
1414
"Accept-Encoding": "gzip, deflate, lzma, sdch, br",
1515
"Accept-Language": "en-US,en;q=0.8",
1616
"CloudFront-Forwarded-Proto": "https",
@@ -42,7 +42,7 @@ def mock_http_event(request):
4242
"cognitoAuthenticationType": "",
4343
"cognitoAuthenticationProvider": "",
4444
"userArn": "",
45-
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48",
45+
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48", # noqa: E501
4646
"user": "",
4747
},
4848
"resourcePath": "/{proxy+}",

tests/test_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_default_settings():
1414
assert handler.lifespan == "auto"
1515
assert handler.log_level == "info"
1616
assert handler.text_mime_types == DEFAULT_TEXT_MIME_TYPES
17-
assert handler.api_gateway_base_path == None
17+
assert handler.api_gateway_base_path is None
1818

1919

2020
@pytest.mark.parametrize(

tests/test_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def app(scope, receive, send):
3333
"aws.event": {
3434
"body": None,
3535
"headers": {
36-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
36+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
3737
"Accept-Encoding": "gzip, deflate, lzma, sdch, " "br",
3838
"Accept-Language": "en-US,en;q=0.8",
3939
"CloudFront-Forwarded-Proto": "https",
@@ -153,7 +153,7 @@ async def app(scope, receive, send):
153153
"aws.event": {
154154
"body": None,
155155
"headers": {
156-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
156+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
157157
"Accept-Encoding": "gzip, deflate, lzma, sdch, " "br",
158158
"Accept-Language": "en-US,en;q=0.8",
159159
"CloudFront-Forwarded-Proto": "https",

0 commit comments

Comments
 (0)