Skip to content
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

Invert if statements (io-keymanagement) #1733

Merged
merged 1 commit into from Jul 4, 2019

Conversation

Projects
None yet
4 participants
@yahiheb
Copy link
Contributor

commented Jul 4, 2019

No description provided.


return true;
}
else

This comment has been minimized.

Copy link
@benthecarman

benthecarman Jul 4, 2019

Contributor

Don't need this else statement

This comment has been minimized.

Copy link
@yahiheb

yahiheb Jul 4, 2019

Author Contributor

In the proposed code you need it.
(there is an else statement in the original code as well, simply the 'else' keyword is not written)

This comment has been minimized.

Copy link
@nopara73

nopara73 Jul 4, 2019

Collaborator

I'm not really picky about this, so it's fine by me either way.


return true;
}
else

This comment has been minimized.

Copy link
@benthecarman

benthecarman Jul 4, 2019

Contributor

Don't need this else statement

@nopara73 nopara73 merged commit 5812912 into zkSNACKs:master Jul 4, 2019

4 checks passed

CodeFactor No issues found.
Details
Wasabi.Linux #20190704.10 succeeded
Details
Wasabi.Osx #20190704.10 succeeded
Details
Wasabi.Windows #20190704.10 succeeded
Details

@yahiheb yahiheb deleted the yahiheb:io-keymanagement-models branch Jul 4, 2019

@molnard

This comment has been minimized.

Copy link
Collaborator

commented Jul 5, 2019

Adding else branches when not required make code-readability worst.

I am with Reduce nesting practice:
https://www.jetbrains.com/help/resharper/InvertIf.html

There are usually two opinions:

Reduce nesting as much as possible as it's easier to follow, because you don't have to remember all those conditions of the current code branch

Ensure that you only have one exit point for your function which ensures that other people looking at your source code to not miss an exit condition above your reading location in a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.