-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
Trying to use wildcards (* and **) in the include config results in no additional file found. According to the Configuration doc, this should be possible:
include [array of paths, optional]: Paths of directories or files that should be included. If no paths are specified, pyright defaults to the directory that contains the config file. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character). If no include paths are specified, the root path for the workspace is assumed.
To Reproduce
pyrightconfig.json:
"include": [
"**/test_cases",
"stubs/**/@tests/test_cases",
"stubs/a/@tests/tests_cases",
"test_cases",
],
"reportUnnecessaryTypeIgnoreComment": "error",Minimal repro:
pyrighttest.zip
Expected behavior
Using the minimal repro above, I expect 2 errors, I only get 1.
Screenshots or Code
(see minimal repro)
pyright
Loading configuration file at E:\Users\Avasam\Documents\Git\pyrighttest\pyrightconfig.json
Assuming Python version 3.9
Assuming Python platform Windows
Auto-excluding **/node_modules
Auto-excluding **/__pycache__
Auto-excluding **/.*
stubPath E:\Users\Avasam\Documents\Git\pyrighttest\typings is not a valid directory.
Searching for source files
File or directory "E:\Users\Avasam\Documents\Git\pyrighttest\test_cases" does not exist.
Found 1 source file
pyright 1.1.291
E:\Users\Avasam\Documents\Git\pyrighttest\stubs\a\@tests\test_cases\check.py
E:\Users\Avasam\Documents\Git\pyrighttest\stubs\a\@tests\test_cases\check.py:1:3 - error: Unnecessary "# type: ignore" comment
1 error, 0 warnings, 0 informations
Completed in 0.711sec
pyright stubs/b/@tests
Loading configuration file at E:\Users\Avasam\Documents\Git\pyrighttest\pyrightconfig.json
Assuming Python version 3.9
Assuming Python platform Windows
Auto-excluding **/node_modules
Auto-excluding **/__pycache__
Auto-excluding **/.*
stubPath E:\Users\Avasam\Documents\Git\pyrighttest\typings is not a valid directory.
Searching for source files
Found 1 source file
pyright 1.1.291
E:\Users\Avasam\Documents\Git\pyrighttest\stubs\b\@tests\test_cases\check.py
E:\Users\Avasam\Documents\Git\pyrighttest\stubs\b\@tests\test_cases\check.py:1:3 - error: Unnecessary "# type: ignore" comment
1 error, 0 warnings, 0 informations
Completed in 0.744sec
VS Code extension or command-line
Command line: pyright and pyright stubs/b/@tests
Additional context
This was noticed in typeshed (hence the minimal repro structure reflects typeshed's stucture).
As you can see, the a test is picked up by "stubs/a/@tests/test_cases", but the b test isn't picked up by "stubs/**/@tests/test_cases". It is, however, picked up by "test_cases" when running the command pyright stubs/b/@tests. Which leads me to believe there's an issue with the wildcards.
CC. @AlexWaygood