Skip to content

Commit 766976f

Browse files
authored
Run the ty type checker in CI (#14129)
1 parent 2ac430c commit 766976f

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

.github/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ jobs:
8080
- name: Type check with pyright
8181
run: pyright
8282

83+
ty:
84+
runs-on: ubuntu-latest
85+
86+
steps:
87+
- uses: actions/checkout@v6
88+
with:
89+
persist-credentials: false
90+
- name: Set up Python
91+
uses: actions/setup-python@v6
92+
with:
93+
python-version: "3"
94+
- name: Install uv
95+
uses: astral-sh/setup-uv@v7
96+
with:
97+
version: latest
98+
enable-cache: false
99+
- name: Install dependencies
100+
run: uv pip install -r pyproject.toml --group package --group test --group types
101+
- name: Type check with ty
102+
run: ty check --color=always
103+
83104
docs-lint:
84105
runs-on: ubuntu-latest
85106

tests/test_ext_autodoc/test_ext_autodoc_mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Base:
131131
def __init__(self):
132132
pass
133133

134-
class Derived(Base, mock.SubClass):
134+
class Derived(Base, mock.SubClass): # ty: ignore[unsupported-base]
135135
pass
136136

137137
obj = Derived()

tests/test_util/typing_test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def f6(x: int, *args, y: str, z: str) -> None:
3939
pass
4040

4141

42-
def f7(x: int = None, y: dict = {}) -> None: # NoQA: B006,RUF013
42+
def f7(x: int = None, y: dict = {}) -> None: # NoQA: B006,RUF013 # ty: ignore[invalid-parameter-default]
4343
pass
4444

4545

ty.toml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,21 @@ include = [
1414
"utils",
1515
]
1616
exclude = [
17-
"tests/roots/test-pycode/cp_1251_coded.py", # Not UTF-8
18-
# This panics (2025-08-18; ty 0.0.1-alpha.18).
19-
# See https://github.com/astral-sh/ty/issues/256
20-
"tests/test_config/test_config.py",
17+
"tests/roots",
2118
]
19+
20+
[rules]
21+
call-non-callable = "ignore"
22+
inconsistent-mro = "ignore"
23+
invalid-argument-type = "ignore"
24+
invalid-assignment = "ignore"
25+
invalid-method-override = "ignore"
26+
invalid-return-type = "ignore"
27+
invalid-type-form = "ignore"
28+
no-matching-overload = "ignore"
29+
non-subscriptable = "ignore"
30+
possibly-missing-attribute = "ignore"
31+
unresolved-attribute = "ignore"
32+
unresolved-import = "ignore"
33+
unresolved-reference = "ignore"
34+
unsupported-operator = "ignore"

0 commit comments

Comments
 (0)