Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 39aba43

Browse files
feat: Add async linting
1 parent 63124e2 commit 39aba43

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ test.integration:
4040
COVERAGE_CORE=sysmon python -m pytest --cov=./ -m "integration" --cov-report=xml:integration.coverage.xml --junitxml=integration.junit.xml -o junit_family=legacy
4141

4242
lint:
43-
make lint.install
44-
make lint.run
43+
# make lint.install
44+
# make lint.run
45+
46+
make mypy-check
4547

4648
lint.install:
4749
echo "Installing..."
@@ -57,6 +59,15 @@ lint.check:
5759
echo "Formatting..."
5860
ruff format --check
5961

62+
63+
# Check if mypy and django-stubs are installed and run type checks
64+
mypy-check:
65+
# Install mypy and django-stubs if they aren't already installed
66+
pip show mypy > /dev/null || pip install mypy
67+
pip show django-stubs > /dev/null || pip install django-stubs
68+
# Run mypy with verbose output
69+
mypy --config-file mypy.ini .
70+
6071
build.requirements:
6172
# if docker pull succeeds, we have already build this version of
6273
# requirements.txt. Otherwise, build and push a version tagged

codecov_auth/tests/unit/views/test_bitbucket_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_get_bbs_redirect(client, settings, mocker):
3030
== "https://my.bitbucketserver.com/plugins/servlet/oauth/authorize?oauth_token=SomeToken"
3131
)
3232
client_request_mock.assert_called_with(
33-
"POST", f"{settings.BITBUCKET_SERVER_URL}/plugins/servlet/oauth/request-token"
33+
"POST", f"{settings.BITBUCKET_SERVER_URL}/z_plugins/servlet/oauth/request-token"
3434
)
3535

3636

@@ -66,11 +66,11 @@ async def fake_list_teams():
6666

6767
async def fake_api(method, url):
6868
if method == "POST" and (
69-
url.endswith("/plugins/servlet/oauth/access-token")
70-
or url.endswith("/plugins/servlet/oauth/request-token")
69+
url.endswith("/z_plugins/servlet/oauth/access-token")
70+
or url.endswith("/z_plugins/servlet/oauth/request-token")
7171
):
7272
return dict(oauth_token="SomeToken", oauth_token_secret="SomeTokenSecret")
73-
elif method == "GET" and url.endswith("/plugins/servlet/applinks/whoami"):
73+
elif method == "GET" and url.endswith("/z_plugins/servlet/applinks/whoami"):
7474
return "ThiagoCodecov"
7575
elif method == "GET" and ("/users/ThiagoCodecov" in url):
7676
return dict(

graphql_api/types/plan/plan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def resolve_trial_status(plan_service: PlanService, info) -> TrialStatus:
3636

3737

3838
@plan_bindable.field("marketingName")
39-
@sync_to_async
4039
def resolve_marketing_name(plan_service: PlanService, info) -> str:
4140
return plan_service.marketing_name
4241

mypy.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ ignore_missing_imports = True
66
disable_error_code = attr-defined,import-untyped,name-defined
77
follow_imports = silent
88
warn_no_return = False
9+
plugins = mypy_django_plugin.main
910

1011
[mypy-*.tests.*]
11-
disallow_untyped_defs = False
12+
disallow_untyped_defs = False
13+
14+
# Enable async ORM checks to catch synchronous ORM calls in async functions
15+
[mypy.plugins.django-stubs]
16+
enable-async-orm-checks = True
17+
django_settings_module = "codecov.settings_dev"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ click==8.1.7
8181
# via
8282
# celery
8383
# click-didyoumean
84-
# click-plugins
84+
# click-z_plugins
8585
# click-repl
8686
click-didyoumean==0.3.0
8787
# via celery

ruff.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,16 @@ indent-width = 4
3636
target-version = "py312"
3737

3838
[lint]
39-
# Currently only enabled for F (Pyflakes), I (isort), E,W (pycodestyle:Error/Warning), PLC/PLE (Pylint:Convention/Error)
40-
# and PERF (Perflint) rules: https://docs.astral.sh/ruff/rules/
41-
select = ["F", "I", "E", "W", "PLC", "PLE", "PERF"]
39+
select = [
40+
"ASYNC", # flake8-async - async checks
41+
"F", # pyflakes - general Python errors, undefined names
42+
"I", # isort - import sorting
43+
"E", # pycodestyle - error rules
44+
"W", # pycodestyle - warning rules
45+
"PLC", # pylint - convention rules
46+
"PLE", # pylint - error rules
47+
"PERF", # perflint
48+
]
4249
ignore = ["F405", "F403", "E501", "E712"]
4350

4451
# Allow fix for all enabled rules (when `--fix`) is provided.

0 commit comments

Comments
 (0)