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?
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())) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With