wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.49k stars 380 forks source link

WPS331 should recommend the opposite #2927

Open Andrej-Marsic opened 4 months ago

Andrej-Marsic commented 4 months ago

Rule request

WPS331 should recommend the opposite, so to be explicit about what the returned value is, instead of leaving it to the cognitive load of the reader to understand it.

Thesis

The return statement should not be the place to call additional functions, but should instead only pass variables.

Reasoning

The only reasoning for this rule is that it provides better readability, but I'd argue that

return whatever_this_function_returns()

is less clear than

bananas = whatever_this_function_returns()
return bananas
rkittens commented 4 months ago

+1

Stanislav-Carny commented 4 months ago

+1