edwardvalentini/EVContactsPicker

View on GitHub
Pod/Classes/EVPickedContactsView.swift

Summary

Maintainability
D
2 days
Test Coverage

Function layoutView has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    func layoutView() -> Void {
        var frameOfLastBubble = CGRect.null
        var lineCount = 0
        
        for contactKey in self.contactKeys! {
Severity: Minor
Found in Pod/Classes/EVPickedContactsView.swift - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File EVPickedContactsView.swift has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import UIKit

class EVPickedContactsView: UIView, EVContactBubbleDelegate, UITextViewDelegate, UIScrollViewDelegate {
    // MARK: - Private Variables
    
Severity: Minor
Found in Pod/Classes/EVPickedContactsView.swift - About 3 hrs to fix

    Function layoutView has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func layoutView() -> Void {
            var frameOfLastBubble = CGRect.null
            var lineCount = 0
            
            for contactKey in self.contactKeys! {
    Severity: Major
    Found in Pod/Classes/EVPickedContactsView.swift - About 2 hrs to fix

      EVPickedContactsView has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class EVPickedContactsView: UIView, EVContactBubbleDelegate, UITextViewDelegate, UIScrollViewDelegate {
          // MARK: - Private Variables
          
          fileprivate var _shouldSelectTextView = false
          fileprivate var scrollView : UIScrollView?
      Severity: Minor
      Found in Pod/Classes/EVPickedContactsView.swift - About 2 hrs to fix

        Function setup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fileprivate func setup() -> Void {
                self.viewPadding = kViewPadding
                
                self.contacts = [:]
                self.contactKeys = []
        Severity: Minor
        Found in Pod/Classes/EVPickedContactsView.swift - About 1 hr to fix

          Function setBubbleColor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              func setBubbleColor(_ color: EVBubbleColor, selectedColor:EVBubbleColor) -> Void {
                  self.bubbleColor = color
                  self.bubbleSelectedColor = selectedColor
                  
                  for contactKey in self.contactKeys! {
          Severity: Minor
          Found in Pod/Classes/EVPickedContactsView.swift - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function textView has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
                  
                  self.textView?.isHidden = false
                  if( text == "\n" ) {
                      return false
          Severity: Minor
          Found in Pod/Classes/EVPickedContactsView.swift - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function removeContact has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              func removeContact(_ contact : EVContactProtocol) -> Void {
                  // let contactKey = NSValue(nonretainedObject: contact)
                      let contactKey = contact.identifier
          
                      if let contacts = self.contacts {
          Severity: Minor
          Found in Pod/Classes/EVPickedContactsView.swift - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status