title: Cyclomatic Complexity Violation: Function should have complexity 10 or less: currently complexity equals 13 (cyclomatic_complexity)
body: <p>I have the following code in swift3 and i am using swift lint for linting the code. The code is given as follows:</p>
  
  <pre><code>    func selectedMenuInLoggedOutState(sender: UIButton) {
      switch sender.tag {
      case 1:
        if let menu = LeftGuestMenu(rawValue: 0) {
          self.changeGuestViewController(menu)
        }
      case 2:
        if let menu = LeftGuestMenu(rawValue: 1) {
          self.changeGuestViewController(menu)
        }
      case 3:
        if let menu = LeftGuestMenu(rawValue: 2) {
          self.changeGuestViewController(menu)
        }
      case 4:
        if let menu = LeftGuestMenu(rawValue: 3) {
          self.changeGuestViewController(menu)
        }
      case 5:
        if let menu = LeftGuestMenu(rawValue: 4) {
          self.changeGuestViewController(menu)
        }
      case 6:
        if let menu = LeftGuestMenu(rawValue: 5) {
          self.changeGuestViewController(menu)
        }
      default:
        break
      }
    }
  </code></pre>
  
  <p>The swift lint generates a "Cyclomatic Complexity Violation" warning. Why did this warning occur and how does one resolve it?</p>
  
  <p><a href="https://i.stack.imgur.com/tHJmT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tHJmT.png" alt="enter image description here"></a></p>