Type hints persist module usage between independent modules (unused-import) #4150
Labels
Bug 🪲
False Negative 🦋
No message is emitted but something is wrong with the code
Import system
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Milestone
When a module is used in a type hint in a certain way it will count as using the module in all source files analyzed afterwards. This leads to a false negative for
unused-import
depending on the order that sources were scanned.Steps to reproduce
Given two files,
a.py
:And
b.py
:Current behavior
When analyzing
a.py
thenb.py
it misses theunused-import
:But swap the order and
unused-import
appears:Expected behavior
The outputs should be identical and both report
unused-import
.pylint --version output
Result of
pylint --version
output:The text was updated successfully, but these errors were encountered: