-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should report on unreachable code after try-return-except-raise #270
Comments
Thanks for the report! Put a little more generally, Vulture should detect that code is unreachable if it occurs after an if-else block or a try-except block where all cases exit the function (with Here is another test case that Vulture currently misses:
I'm happy to review a PR for this :-) |
Mypy has good unreachable code detection, and it can work for such cases even if you don’t use type hints. https://adamj.eu/tech/2021/05/19/python-type-hints-mypy-unreachable-code-detection/ I am not sure it’s worth duplicating this kind of functionality in vulture. |
I disagree, mostly because this is dead-code and users of vulture are expecting it to find dead-code 🤷 |
For a following file:
vulture dead_return.py
doesn't report anything, while it should report code on line 6, as this one is unreachable.
vulture 2.3, python 3.9
The text was updated successfully, but these errors were encountered: