A false negative about the rule RSPEC-3516

Hi, I found a false negative about the rule RSPEC-3516, please read the following code example. SonarQube should report a warning in line 6 because different return statements give identical return values. Hence, I think this is a false negative. Thanks for your consideration.

int foo(int a) {
    int b = 12;
    if (a == 1) {
        return b + 1;
    return b + 1;  // should report a warning here, because same return value with line 4

Hey there.

Thanks for the report. This is a known false-negative hitting the limitations of how this rule implemented (SONARJAVA-3097). I’ve linked your report to that ticket as a way of helping us know what traction there is to address it in the future.

Hi Colin, thanks for your confirmation. :smile: