Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-4110

FN in S1751 when all jumps are nested into a code block

    XMLWordPrintable

    Details

    • Type: False Negative
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Rules
    • Labels:
      None

      Description

      S1751 will only raise an issue when a "jump" is directly present in the block of the loop, missing cases where it can be nested into another one.

          for (int i = 0; i < 10; i++) {
            if(tag) {
              break; // FN
            } else {
              break;
            }
          }
      
          for (int i = 0; i < 10; i++) {
            if(tag) {
              break; // Correctly raise an issue
            }
            break;
          }
      
          for (int i = 0; i < 10; i++) {
            if(true) {
              break; // FN
            }
          }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: