Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 8 8
Branches 1 1
=========================================
Hits 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
benoit74
force-pushed
the
fix-check-all-pyright-scoping
branch
from
November 27, 2026 16:10
9e9d871 to
4b86971
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pyrightscopes itself via[tool.pyright] includeinpyproject.toml.check_all(andfix_all's sibling call pattern) passes its ownargs or "."fallback — needed soruffchecks the whole tree when invoked bare via the hatch script — straight through tocheck_typeas well, which forwards it aspyright .. An explicit path argument overridespyright'sincludescoping and falls back to exclude-only filtering, so any directory outsideinclude(e.g. a project's owncontrib/,scripts/, or similar folder not listed in["src", "tests", "tasks.py"]) gets type-checked too, and can report spurious errors that have nothing to do with the change under review.Found this while consuming the template in
openzim/youtube(openzim/youtube#483), where it surfaced real false-positive errors oncontrib/andtests-integration/(both outsideinclude) — but only when going throughcheck_all/fix_all, not when callingcheck_typedirectly, which made it a bit of a head-scratcher at first.Fix
Keep a separate
ruff_argsvariable for the lint/format calls (which do need the.fallback) and leavecheck_type's own default untouched, socheck_all/fix_allbehave exactly like callingcheck_typeon its own.Verification
Reproduced locally against this repo: with a file placed outside
includecontaining a genuine type error,inv check-allincorrectly flagged it before this change, and correctly ignores it after.Note
I noticed
CHANGELOG.md's[Unreleased]section already has a related entry ("Pyright ignores.hatch/**..."), so I added mine alongside it rather than opening a separate discussion about versioning.