-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Python] [LGTM.com] False-positive: Unreachable statement: #2206 sequel #2351
Comments
This was an interesting case. The problem here is that we are not identifying the calls to As it turns out, we are analysing this project as a Python 2.7 project, so this explains why the fallback version of In this case, I think there's a more general solution that can be applied, without resorting to looking for specific well-known context handlers (which can fail, as the present example shows). Hopefully we should be able to roll out a fix soon. Thanks for the report! |
Right, any context manager can choose to suppress exceptions via its |
Got another instance of this: https://lgtm.com/projects/g/ansible/ansible-lint/snapshot/4741210b9feefe9ed54c59a731c1636fd648400e/files/lib/ansiblelint/utils.py?sort=name&dir=ASC&mode=heatmap#x92b14f87ccfa33b7:1 Basically, the same except it uses for ...:
contextlib.suppress(Exc):
...
continue
some_code # <-- marked as unreachable but in fact, is totally reachable |
Description of the false positive
Same as #2206. Except the reproducer contains several subsequent
suppress()
es:So I guess #2078 needs more test cases maybe...
URL to the alert on the project page on LGTM.com
https://lgtm.com/projects/g/cherrypy/cheroot/snapshot/0c678bab518ca17151540b7d744faca49b941763/files/cheroot/ssl/builtin.py#x46e331ef60ba4bf1:1
The text was updated successfully, but these errors were encountered: