Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity
    • Default Quality Profiles:
      Sonar way

      Description

      For better readability, do not put more than one statement on a single line.

      Noncompliant Code Example

      if someCondition { doSomething()}
      ...
      var result = doSomething(); return result
      

      Compliant Solution

      if someCondition {
        doSomething()
      }
      ...
      var result = doSomething()
      return result
      

      Exceptions

      Variable declaration with initialising code block and closure expressions containing a single statement are ignored.

      var x : Int { return 0 }                                       // Variable declaration with initialising code block
      doSomething({ (x: Int, y: Int) -> Bool in return x > y }, 5)   // Closure expression
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                elena.vilchik Elena Vilchik
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: