Skip to content

Commit

Permalink
Add flake8 to CI checks (Kludex#157)
Browse files Browse the repository at this point in the history
* βž• add flake8 requirement for linting

* πŸ‘· add flake8 to lint script

* 🚨 fix linter warnings

* πŸ‘· add scripts/lint to github test workflow
  • Loading branch information
ediskandarov authored and four43 committed Aug 20, 2021
1 parent 522692c commit 344a70e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ jobs:
- name: Run tests
run: |
scripts/test
- name: Run linters
run: |
scripts/lint
- name: Run codecov
run: codecov
2 changes: 1 addition & 1 deletion mangum/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .adapter import Mangum
from .adapter import Mangum # noqa: F401
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pytest
codecov
pytest-cov
black
flake8
starlette
quart; python_version == '3.7'
moto
Expand All @@ -11,4 +12,4 @@ brotli
brotli-asgi
# Docs
mkdocs
mkdocs-material
mkdocs-material
3 changes: 2 additions & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ fi
set -x

${PREFIX}black mangum tests --check
${PREFIX}mypy mangum --disallow-untyped-defs --ignore-missing-imports
${PREFIX}mypy mangum --disallow-untyped-defs --ignore-missing-imports
${PREFIX}flake8 mangum tests
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def mock_http_event(request):
"path": "/test/hello",
"body": body,
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
"Accept-Encoding": "gzip, deflate, lzma, sdch, br",
"Accept-Language": "en-US,en;q=0.8",
"CloudFront-Forwarded-Proto": "https",
Expand Down Expand Up @@ -42,7 +42,7 @@ def mock_http_event(request):
"cognitoAuthenticationType": "",
"cognitoAuthenticationProvider": "",
"userArn": "",
"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",
"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
"user": "",
},
"resourcePath": "/{proxy+}",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_default_settings():
assert handler.lifespan == "auto"
assert handler.log_level == "info"
assert handler.text_mime_types == DEFAULT_TEXT_MIME_TYPES
assert handler.api_gateway_base_path == None
assert handler.api_gateway_base_path is None


@pytest.mark.parametrize(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def app(scope, receive, send):
"aws.event": {
"body": None,
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
"Accept-Encoding": "gzip, deflate, lzma, sdch, " "br",
"Accept-Language": "en-US,en;q=0.8",
"CloudFront-Forwarded-Proto": "https",
Expand Down Expand Up @@ -153,7 +153,7 @@ async def app(scope, receive, send):
"aws.event": {
"body": None,
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", # noqa: E501
"Accept-Encoding": "gzip, deflate, lzma, sdch, " "br",
"Accept-Language": "en-US,en;q=0.8",
"CloudFront-Forwarded-Proto": "https",
Expand Down

0 comments on commit 344a70e

Please sign in to comment.