False negative: no-member in conditional branch #9405
Labels
False Negative 🦋
No message is emitted but something is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Bug description
There is a difference in behavior inside conditional branches depending on if the branch is reachable or not. If it is unreachable, then
undefined-variable
warnings are emitted, butno-member
warnings are not (whereas if it is reachable, bothundefined-variable
andno-member
warnings are emitted).For example:
This does not report
no-member
fordatetime.does_not_exist
. However, if we changeSOME_BOOL = False
toSOME_BOOL = True
, then theno-member
warning is emitted.This can also happen for more complex conditionals, where it's not clear whether or not the branch is reachable. If pylint is performing fewer checks in conditional branches that it determines are unreachable as a performance optimization, then it probably should at least report that the branch as unreachable.
Thank you!
Configuration
No response
Command used
Pylint output
Expected behavior
Pylint version
OS / Environment
RHEL8
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: