Run pyright and ruff with the configuration from the correct directory #231
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.
Issue #, if available:
N/A
Description of changes:
Quality checks currently do not correctly run against files under
./images
due to how pyright resolves its configuration frompyrightconfig.json
. Specifically, pyright will use thepyrightconfig.json
file in your current directory even if you specify a different root path as an argument.This is evidenced by running pyright manually in verbose mode:
Two valid approaches exist:
cd
s into the target directory, then runs pyright on the current directorypyrightconfig.json
path-p
switch pointing to thepyrightconfig.json
file in the target folderThis draft PR uses approach 1 and applies it to both ruff and pyright as it is less likely to be impacted by nuanced semantics caused by running the tools from a different directory. I'm leaving this as a draft PR as there are 80+ pyright failures per image directory that I do not have availability to resolve. Most of these failures are unnecessary imports or incomplete typings on things like lists (e.g.
foo = []
vsfoo: list[str] = []
).Fixing this linting will ensure invalid code, such as missing imports, are caught before being merged.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.