Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to ignore reportUninitializedInstanceVariable in stubs #4137

Closed
Avasam opened this issue Nov 4, 2022 · 2 comments
Closed

Option to ignore reportUninitializedInstanceVariable in stubs #4137

Avasam opened this issue Nov 4, 2022 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@Avasam
Copy link

Avasam commented Nov 4, 2022

Is your feature request related to a problem? Please describe.
reportUninitializedInstanceVariable is raised in type stubs. Since there's not way to disable rules per folder or file-type, I have to disable it entirely or add # pyright: reportUninitializedInstanceVariable=false at the top of all my stubs.

Describe the solution you'd like
An option to ignore reportUninitializedInstanceVariable in .pyi files specifically.

Additional context
A workaround is to add =... but that does no comply with Typeshed's practices.
Since both are valid, this is more of a stylistic choice. Enforcing it forces redundancy.

@Avasam Avasam added the enhancement request New feature or request label Nov 4, 2022
@erictraut
Copy link
Collaborator

I agree that this check doesn't make sense for stub files. I've changed pyright to skip the check entirely for stubs. This will be included in the next release.

erictraut pushed a commit that referenced this issue Nov 4, 2022
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Nov 4, 2022
@erictraut
Copy link
Collaborator

This is included in pyright 1.1.279, which I just published. It will also be included in a future version of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants