Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-76

Rule S131: "switch" statements should have "default" clauses

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1
    • Component/s: Ruby, Rules
    • Labels:
      None

      Description

      The Kotlin compiler allows when without else when it's used as a statement.

      https://kotlinlang.org/docs/reference/control-flow.html

      If when is used as an expression, the else branch is mandatory, unless the compiler can prove that all possible cases are covered with branch conditions.

      We should therefore exclude switch which are not statements.

      Does not apply to Kotlin (see comments)
      Applies to Ruby

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                christophe.zurn Christophe Zurn
                Reporter:
                pierre-yves.nicolas Pierre-Yves Nicolas
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: