-
-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forbid local variables that are only used in return
statements
#471
Comments
Can I start working on this ? To clarify the fix would be to remove all these intermediate variables in all function returns? |
@loucadufault you are welcome! The fix would be to return a direct value. Wrong: def some_function():
some_value = 1
return some_value Correct: def some_function():
return 1 |
Can I work on this issue? |
@Chinmaygoyal I am on finish line to complete this issue |
@Chinmaygoyal feel free to take #545 |
Hello @sobolevn def function(a):
result = None
if a:
... # some actions
result = 123
return result As for me, it is also understandable from the naming of value what we will return after calling of function. |
@DmytroLitvinov yes, this code is valid. What do you mean by:
|
* Update noqa.py * Add files via upload * Delete out.log * Update CHANGELOG.md * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Fix minor things Fix function return type Change dict.setdefault() on collections.defaultdict(list) * Fix minor things * Add files via upload
Rule request
Thesis
Sometimes I see code like this:
What the point in creating this intermediate variable? Why do we need it?
Reasoning
This is done for consistency and more readable source code.
The text was updated successfully, but these errors were encountered: