Open jond01 opened 5 days ago
Thanks. I agree that this is surprising. I assume this is "intentional" because Ruff doesn't know to what types Letter
resolves. E.g. Letter
could be defined as type Letter = str | None
in which case the assignment is valid. Not sure if there's another reason for it as well (CC: @charliermarsh )
Documenting this restriction is a good idea.
I assume this is "intentional" because Ruff doesn't know to what types
Letter
resolves. E.g.Letter
could be defined astype Letter = str | None
in which case the assignment is valid. Not sure if there's another reason for it as well
Yeah, I think this is pretty much the reason. The logic considers all custom type to be similar to Any
which is the case here.
For context, the fallback branch tries to resolve the name Letter
to a qualified name which doesn't exists and thus fallback to using Unknown
(similar to Any
).
It seems like the following should be caught or at least be added to the documented limitations:
ruff check file.py --select RUF013