Skip to content

Commit 8ca2b55

Browse files
authored
Dogfood ty on py-fuzzer in CI (astral-sh#20946)
1 parent 6d2cf34 commit 8ca2b55

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ jobs:
277277
run: cargo test -p ty_python_semantic --test mdtest || true
278278
- name: "Run tests"
279279
run: cargo insta test --all-features --unreferenced reject --test-runner nextest
280-
280+
# Dogfood ty on py-fuzzer
281+
- run: uv run --project=./python/py-fuzzer cargo run -p ty check --project=./python/py-fuzzer
281282
# Check for broken links in the documentation.
282283
- run: cargo doc --all --no-deps
283284
env:
@@ -519,6 +520,7 @@ jobs:
519520
with:
520521
persist-credentials: false
521522
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
523+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
522524
- name: "Install Rust toolchain"
523525
run: rustup component add rustfmt
524526
# Run all code generation scripts, and verify that the current output is
@@ -533,6 +535,11 @@ jobs:
533535
./scripts/add_plugin.py test --url https://pypi.org/project/-test/0.1.0/ --prefix TST
534536
./scripts/add_rule.py --name FirstRule --prefix TST --code 001 --linter test
535537
- run: cargo check
538+
# Lint/format/type-check py-fuzzer
539+
# (dogfooding with ty is done in a separate job)
540+
- run: uv run --directory=./python/py-fuzzer mypy
541+
- run: uv run --directory=./python/py-fuzzer ruff format --check
542+
- run: uv run --directory=./python/py-fuzzer ruff check
536543

537544
ecosystem:
538545
name: "ecosystem"

python/py-fuzzer/fuzz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def print_description(self, index: int, num_seeds: int) -> None:
139139
case Executable.TY:
140140
panic_message = f"The following code triggers a {new}ty panic:"
141141
case _ as unreachable:
142-
assert_never(unreachable)
142+
assert_never(unreachable) # ty: ignore[type-assertion-failure]
143143

144144
print(colored(panic_message, "red"))
145145
print()

python/py-fuzzer/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ warn_unreachable = true
3232
local_partial_types = true
3333
enable_error_code = "ignore-without-code,redundant-expr,truthy-bool"
3434

35+
[tool.ty.rules]
36+
possibly-unresolved-reference = "error"
37+
unused-ignore-comment = "error"
38+
3539
[tool.ruff]
3640
fix = true
3741
preview = true

0 commit comments

Comments
 (0)