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

Check to detect unnecessary if/else condition nesting #173

Open
Gama11 opened this issue Mar 12, 2016 · 0 comments
Open

Check to detect unnecessary if/else condition nesting #173

Gama11 opened this issue Mar 12, 2016 · 0 comments

Comments

@Gama11
Copy link
Member

Gama11 commented Mar 12, 2016

Would be nice to detect code like this:

if (conditionA) {
    if (conditionB) {
        doSomething();
    }
}

which would be better written as:

if (conditionA && conditionB) {
    doSomething();
}

or

if (conditionA) {
    doSomething();
}
else {
    if (conditionB) {
        doSomething();
    }
}

which could use else if.

Not sure if this should be a new check or be covered by SimplifyBooleanExpression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant