Comment 2 for bug 1324277

Revision history for this message
Johannes Erdfelt (johannes.erdfelt) wrote :

I'm not sure why my patch never got linked here by the gerrit bot:

https://review.openstack.org/#/c/96293/

I looked into a hacking check when I wrote the patch. pep8 allows you to get the current logical line and the previous logical line. That would be sufficient to catch a subset of cases (where return is the first statement after finally). That seemed like a poor solution.

There is also the 'lines' argument that a check can use, but it effectively requires writing a parser for the Python language.

I've thrown around the idea of parsing the AST but it was sufficiently different that I didn't know how something like that could get merged and I didn't want to hold up this patch.