sonar-collapsible if statements

eclipse, java, performance, pmd, sonarqube

Solution

see the pmd explanation for this: http://qa.nuiton.org/sonar/rules/show/pmd:CollapsibleIfStatements?layout=false

PMD/Sonar identified, that you don't need 2 if statements, but can rather combine it to one using AND/OR opeartors.

this should be OK:

if (getSomething().equals(getSomething()) && getsomehing.contains(getSomething())) {
}

Problem

I am getting the exception "collapsible if statement". Through the sonar in the following code. ``` if(getSomething().equals(getSomething()){ if(getsomehing.contains(getSomething()){ } } ``` Collapsible if statements These statements could be combined. What is the meaning of this metric?

Original source