Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity
    • Legacy Key:
      OneStatementPerLine

      Description

      Noncompliant Code Example

      foo(); bar(); // Noncompliant
      

      Compliant Solution

      foo();
      bar();
      

      Exceptions

      Control flow statements with a single nested statement are ignored.

      if (condition) doSomething();       // Compliant
      while (condition) doSomething();    // Compliant
      

      case or default statements containing a single statement and followed by break are ignored.

      switch (foo) {
        case  0: doSomething(); break;    // Compliant
        default: doSomething(); break;    // Compliant
      }
      

      Statements enclosed in curly braces on the same line are ignored.

      auto lambda = [](int x) { doSomething(x); return x; }; // Compliant
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jeanchristophe.collet Jean-Christophe Collet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: