pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

Check inconsistent return statements

Open r3m0t opened this issue 8 years ago • 3 comments

This implements the same as #431 #527 (requested in #399). This is about the best that can be done without importing the ast module, and therefore this PR is much smaller.

PEP8:

Be consistent in return statements. Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None, and an explicit return statement should be present at the end of the function (if reachable).

This:

Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None.

r3m0t avatar Dec 02 '17 23:12 r3m0t