-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
False Negative 🦋No message is emitted but something is wrong with the codeNo message is emitted but something is wrong with the codeHelp wanted 🙏Outside help would be appreciated, good for new contributorsOutside help would be appreciated, good for new contributorsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Current problem
This mistake recently bit a coworker of mine:
some_dict = {0: 1}.update({2: 3})
# This will fail, as `some_dict` is actually `None`
assert isinstance(some_dict, dict)
Obviously this type of error one should catch in unit testing, but we didn't have tests. mypy
can catch this only if one adds type annotations.
I am wondering, can pylint
catch this in the future, without type annotations?
Desired solution
pylint
would:
- Understand that
some_dict
is actuallyNone
- Know that its usage downstream as a
dict
will fail
In other words the request: pylint
catching errors associated with None
returns later being used as if not None
.
Additional context
No response
Metadata
Metadata
Assignees
Labels
False Negative 🦋No message is emitted but something is wrong with the codeNo message is emitted but something is wrong with the codeHelp wanted 🙏Outside help would be appreciated, good for new contributorsOutside help would be appreciated, good for new contributorsNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation