Remove some unnecessary empty return statements#455
Conversation
Note that this commit does not remove all of the unnecessary empty return statements
jwiggins
left a comment
There was a problem hiding this comment.
It seems like there should be a tool that can do this for us...
modified: enable/viewable.py
| # This overrides the default Component request_redraw by asking | ||
| # all of the views to redraw themselves. | ||
| return |
There was a problem hiding this comment.
You can also just change the comment to a docstring so that the return can still be removed.
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
- Coverage 30.26% 29.14% -1.12%
==========================================
Files 206 206
Lines 18143 17954 -189
Branches 2461 2466 +5
==========================================
- Hits 5491 5233 -258
- Misses 12309 12394 +85
+ Partials 343 327 -16
Continue to review full report at Codecov.
|
kitchoi
left a comment
There was a problem hiding this comment.
LGTM. I reviewed the code surrounding the removal and confirmed (the best I could) that they are all at the end of a function (not early termination, and not function whose API explicitly requires a None to be returned)
| tool._activate() | ||
|
|
||
| self.invalidate_and_redraw() | ||
| return |
There was a problem hiding this comment.
There is one more return at the bottom of _old_dispatch which can be removed.
| if (x != self._cur_x) or (y != self._cur_y): | ||
| self._cur_x, self._cur_y = x, y | ||
| self.redraw() | ||
| return |
There was a problem hiding this comment.
The return at the bottom of _draw (next function) can be removed too.
| self.__order__ = self.__order__[1:] + [key] | ||
| else: | ||
| self.__order__.append(key) | ||
| return |
There was a problem hiding this comment.
No action. Just an observation that this will conflict with #392
(There are probably plenty of opportunity for merge conflicts anyway.)
|
Since this PR was opened, a number of PRs have gone in, including one that updates the CI configuration to require tests to pass on wx. As a sanity check, it would be good to merge master in here to get another CI run before we merge. |
This PR removes a number of unnecessary empty return statements from the codebase - from
enable, fromkiva, from the test suite and from the examples.Apologies to the reviewer because this is quite an ugly PR to review. I checked each
returnstatement to ensure that the empty statement is not part of conditional logic/earlyreturnfrom a function/method. Only emptyreturns at the end of functions/methods are removed.