You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Developers might opt for the first one because saving characters, but if the priority is clarity, there's an additional investigation that one needs to perform with the first option, while the name might clearly giveaway what we're getting in the latter
It's easier to track where the first creation of the variable came to be as without it the actual function that creates bananas might not mention bananas at all, even if that's its only purpose
It allows for easier tracking when traversing the inputs and outputs of a series of functions as the outputs are spelled out
The text was updated successfully, but these errors were encountered:
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
is less clear than
The text was updated successfully, but these errors were encountered: