-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
The following I'm pretty sure should be disabled in stubs, as they are out of a stub author's control:
- builtin-variable-shadowing (A001) (344 hits in typeshed)
This happens with aliases and other top-level variables. Non-runtime type aliases should be private in the first place. Devs also shouldn't try to import builtins from a module that happens to import said builtin. And finally this rule mostly tries to protect against using the shadowed variable. In a typing-only context, you should mostly be guarded by type tests anyway. - builtin-argument-shadowing (A002) (2085 hits on typeshed)
- builtin-attribute-shadowing (A003)
- builtin-module-shadowing (A005) (done in [
flake8-builtins] DisapplyA005to stub files #15350)
As for the rest:
- builtin-import-shadowing (A004) (53 hits in typeshed, nearly all re-exports)
Very similar asA001but can actually be worked around with import aliases and re-export aliases. (which would triggerA001instead)
Could maybe be ignored in stubs if re-exported ? (import print as print,from tensorflow.math import abs as abs,import foo as print; print = printandimport foo as print; __all__= ["print"]) - builtin-lambda-argument-shadowing (A006)
I don't think lambdas apply to type stubs anyway. Probably doesn't need to be ignored.
Ruff: 0.8.5
(this report is extracted from #14535 (comment) and #14535 (comment) for ease of tracking and discussion)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule