`get_*` functions must return something.
See original GitHub issueRule request
Thesis
Functions and methods with get_
prefix must return something (have return
or yield
in the body).
Reasoning
get_
function is expected to return what it promises to return. For example, get_user
returns a user object. If it’s not so, it’s an error or a bad interface.
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Does a function always need to return something? - Python FAQ
Answer. NO, a function does not always have to have an explicit return statement. If the function doesn't need to provide any results ......
Read more >The Python return Statement: Usage and Best Practices
In this step-by-step tutorial, you'll learn how to use the Python return statement when writing functions. Additionally, you'll cover some good programming ...
Read more >Function return values - Learn web development | MDN
When the function completes (finishes running), it returns a value, which is a new string with the replacement made. In the code above,...
Read more >Function must return a value - c++ - Stack Overflow
A declared std::string function should return a string and this is not the same as printing it on the screen, use return "something"...
Read more >12.5. Returning a value from a function - Runestone Academy
You'll want to iterate over all the items in the list, each of the strings. As soon as you get to one name...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sobolevn Sorry to bother again.
The code is almost complete. But I wondered whether or not we should check every execution path a function can take to make sure it consistently returns a value .
Consider:
Should
get_bar
raiseGetterWithoutReturnViolation
?@hhsdev we already have a different rule that checks for consistent returns. This rule should check that we have at least one non-empty return.