From 4b86971be4e99a97dd66736237373980f30f1242 Mon Sep 17 00:00:00 2001 From: benoit74 Date: Fri, 27 Nov 2026 16:06:20 +0000 Subject: [PATCH] Fix check_all/fix_all forwarding ruff's "." arg into pyright pyright scopes itself via [tool.pyright] include in pyproject.toml. check_all passed its own args-or-"." fallback (needed so ruff checks the whole tree when invoked bare via hatch) straight through to check_type as well, which forwards it as `pyright .`. An explicit path argument overrides pyright's include scoping and falls back to exclude-only filtering, so any directory outside include (e.g. a project's own contrib/ or scripts/ folder, anything not in ["src", "tests", "tasks.py"]) gets type-checked and can report spurious errors that have nothing to do with the change under review. Found while consuming this template in openzim/youtube, where it surfaced real false-positive errors on contrib/ and tests-integration/ (both outside include) only when going through check_all/fix_all, not when calling check_type directly. Reproduced and verified the fix here too: a file with a genuine type error placed outside include is (correctly) ignored by `inv check-all` after this change, and was (incorrectly) flagged before it. --- CHANGELOG.md | 3 +++ tasks.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a287cbf..c652fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Pyright ignores `.hatch/**` and git ignores `.hatch/` +- `check_all`/`fix_all` no longer forward the `.` path argument meant for `ruff` + into `pyright` as well, which overrode its `[tool.pyright] include` scoping and + could report spurious errors on any directory outside of it (#60) ## [2.0.0] - 2026-05-26 diff --git a/tasks.py b/tasks.py index 91def6a..68ed59e 100644 --- a/tasks.py +++ b/tasks.py @@ -92,9 +92,9 @@ def fix_format(ctx: Context, args: str = "."): @task(optional=["args"], help={"args": "additional arguments"}) def check_all(ctx: Context, args: str = ""): """check linting, formatting and static types""" - args = args or "." # needed for hatch script - check_lint(ctx, args) - check_format(ctx, args) + ruff_args = args or "." # needed for hatch script + check_lint(ctx, ruff_args) + check_format(ctx, ruff_args) check_type(ctx, args)