microsoft / pyright

Static Type Checker for Python
Other
13.02k stars 1.39k forks source link

Gives exit code 0 on inexistant file or direcory in pyrightconfig.json include #8234

Closed rik closed 2 months ago

rik commented 2 months ago

Describe the bug https://github.com/microsoft/pyright/issues/6443 fixed the issue when providing files or directories via the CLI. The issue still exists if you have missing files in pyrightconfig.json

Code or Screenshots

$ cat pyrightconfig.json
{
    "include": ["inexistant_file.py"]
}

$ pyright; echo $?
File or directory "/Users/me/inexistant_file.py" does not exist.
0 errors, 0 warnings, 0 informations 
0

VS Code extension or command-line

$ pyright --version
pyright 1.1.369
erictraut commented 2 months ago

As explained in the other bug, pyright's config supports globs (wildcard) file and directory specifiers, and it's perfectly legitimate for these globs to match no files or directories. I don't think it would be appropriate to emit an error under these conditions. That is, I think pyright is working correctly, so I'm closing this as "won't fix".

rik commented 2 months ago

Thanks for the quick feedback.

I'm not asking to emit an error for globs with no matches. I'm asking to have the same behaviour when files/directories are provided via the CLI or via the include field.

As you said in the other bug:

I guess we could consider it an error if the "root" of the file descriptor (the non-wildcard portion) doesn't exist. That's what we do to emit the "does not exist" error that you are seeing.