Rule not detected RSPEC-2252

Hi Team,

The expected SonarQube bug appears not to be caught in the code below, even though it’s caught in a very similar code as seen in the screenshot. Any thoughts?

class LoopConditionBug {
    public void showBug() {
        boolean loopCondition = getLoopCondition(); 

        for (int i = 0; i < 0 && loopCondition; i++) {  
            System.out.println("This line of code should never be executed");
        }
    }
    private boolean getLoopCondition() {
        return false;
    }
}

Screenshot of code scan result

Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006

1 Like

Hello, thanks for the multiple reports.

I have created this ticket to group them up and keep track of them. We will investigate them as soon as we have the capacity for it!

Have a good day :slight_smile: