-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Feat/type checker #1637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feat/type checker #1637
Changes from all commits
109148a
aeee746
5e8ee05
a709b40
9ddc6c4
4d9f1af
d92e0b7
ca8e31f
b6705cb
8002554
4b9f171
c5cc15b
b7c3970
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Code Quality | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "**.py" | ||
| - "**.toml" | ||
| - "Makefile" | ||
| - "uv.lock" | ||
| - ".github/workflows/code-quality.yml" | ||
| push: | ||
| branches-ignore: | ||
| - master | ||
| - staging | ||
| paths: | ||
| - "**.py" | ||
| - "**.toml" | ||
| - "Makefile" | ||
| - "uv.lock" | ||
| - ".github/workflows/code-quality.yml" | ||
|
|
||
| jobs: | ||
| ruff: | ||
| name: Ruff (lint) | ||
| runs-on: ubuntu-latest | ||
| # TODO: remove once the codebase is fully lint-clean | ||
| continue-on-error: true | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Setup uv | ||
| uses: ./.github/actions/setup-uv | ||
| - name: Install dependencies | ||
| run: make install | ||
| - name: Lint | ||
| run: make lint-check || true | ||
| - name: Summary | ||
| if: always() | ||
| run: | | ||
| { | ||
| echo "## Ruff lint results" | ||
| echo | ||
| echo "<details><summary>Expand to see all errors (backlog while the codebase is being linted incrementally)</summary>" | ||
| echo | ||
| echo '```' | ||
| uv run ruff check --output-format=concise . || true | ||
| echo '```' | ||
| echo | ||
| echo "</details>" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| ty: | ||
| name: ty (type-check) | ||
| runs-on: ubuntu-latest | ||
| # TODO: remove once the codebase is fully typed | ||
| continue-on-error: true | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Setup uv | ||
| uses: ./.github/actions/setup-uv | ||
| - name: Install dependencies | ||
| run: make install | ||
| - name: Type-check | ||
| run: make typecheck || true | ||
| - name: Summary | ||
| if: always() | ||
| run: | | ||
| { | ||
| echo "## ty type-check results" | ||
| echo | ||
| echo "<details><summary>Expand to see all errors (backlog while the codebase is being typed incrementally)</summary>" | ||
| echo | ||
| echo '```' | ||
| uv run ty check --output-format=concise || true | ||
| echo '```' | ||
| echo | ||
| echo "</details>" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
|
Naramsim marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| """ | ||
| ASGI config for PokeAPI. | ||
|
Naramsim marked this conversation as resolved.
|
||
|
|
||
| It exposes the ASGI callable as a module-level variable named ``application``. | ||
|
|
||
| For more information on this file, see | ||
| https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/ | ||
| """ | ||
|
|
||
| import os | ||
|
|
||
| from django.core.asgi import get_asgi_application | ||
|
|
||
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") | ||
|
|
||
| application = get_asgi_application() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| # Docker settings | ||
| from .settings import * | ||
| # ruff: noqa: F405 | ||
| # pyright: reportConstantRedefinition=false | ||
| from .settings import * # noqa: F403 | ||
|
|
||
| DATABASES = { | ||
| DATABASES: dict[str, DatabaseSettings] = { | ||
| "default": { | ||
| "ENGINE": "django.db.backends.postgresql", | ||
| "NAME": "pokeapi", | ||
|
|
@@ -13,7 +15,7 @@ | |
| } | ||
|
|
||
|
|
||
| CACHES = { | ||
| CACHES: dict[str, CacheSettings] = { | ||
| "default": { | ||
| "BACKEND": "django_redis.cache.RedisCache", | ||
| "LOCATION": "redis://127.0.0.1:6379/1", | ||
|
|
@@ -24,3 +26,7 @@ | |
| } | ||
|
|
||
| DEBUG = True | ||
|
|
||
| for template in TEMPLATES: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this? Where is TEMPLATE defined?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
the previous https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/ |
||
| if "OPTIONS" in template and "debug" in template["OPTIONS"]: | ||
| template["OPTIONS"]["debug"] = DEBUG | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,22 @@ | ||
| from .settings import * | ||
| # pyright: reportConstantRedefinition=false | ||
| # ruff: noqa: F405 | ||
| from .settings import * # noqa: F403 | ||
|
|
||
| DATABASES = { | ||
| DATABASES: dict[str, DatabaseSettings] = { | ||
| "default": { | ||
| "ENGINE": "django.db.backends.sqlite3", | ||
| "NAME": BASE_DIR / "db.sqlite3", | ||
| } | ||
| } | ||
|
|
||
| CACHES = { | ||
| CACHES: dict[str, CacheSettings] = { | ||
| "default": { | ||
| "BACKEND": "django.core.cache.backends.dummy.DummyCache", | ||
| } | ||
| } | ||
|
|
||
| DEBUG = True | ||
|
|
||
| for template in TEMPLATES: | ||
| if "OPTIONS" in template and "debug" in template["OPTIONS"]: | ||
| template["OPTIONS"]["debug"] = DEBUG |
Uh oh!
There was an error while loading. Please reload this page.