Created
July 11, 2012 11:12
-
-
Save DavidArno/3089726 to your computer and use it in GitHub Desktop.
Resharper bad code advice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Take the following method: | |
private void UpdateCurrentBall() | |
{ | |
_currentBall++; | |
if (_currentBall == 3) | |
{ | |
_currentBall = 0; | |
_currentFrame++; | |
} | |
} | |
Resharper wants to reformat it as: | |
private void UpdateCurrentBall() | |
{ | |
_currentBall++; | |
if (_currentBall != 3) return; | |
_currentBall = 0; | |
_currentFrame++; | |
} | |
Whilst this does reduce nesting, it also creates code that is more complex for the reader to understand IMO. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm torn, I agree ReSharper is pretty invasive, but if you were to add some whitespace then I think it becomes a lot clearer...