edwardvalentini/EVContactsPicker

View on GitHub

Showing 33 of 33 total issues

File EVContactsPickerViewController.swift has 404 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import UIKit
import Contacts
import ContactsUI


Severity: Minor
Found in Pod/Classes/EVContactsPickerViewController.swift - About 5 hrs to fix

    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

        EVContactsPickerViewController has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @available(iOS 9.0, *)
        @objc open class EVContactsPickerViewController: UIViewController, UITableViewDataSource, UITableViewDelegate,  EVPickedContactsViewDelegate, CNContactViewControllerDelegate {
            
            
            let kKeyboardHeight : CGFloat = 0.0
        Severity: Minor
        Found in Pod/Classes/EVContactsPickerViewController.swift - About 2 hrs to fix

          Function refreshContact has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              func refreshContact(_ contact: EVContactProtocol) {
                  if( self.useExternal == false ) {
                      do {
                          if let tmpContact = try self.store?.unifiedContact(withIdentifier: contact.identifier, keysToFetch: [CNContactEmailAddressesKey as CNKeyDescriptor,CNContactGivenNameKey as CNKeyDescriptor,CNContactFamilyNameKey as CNKeyDescriptor,CNContactImageDataAvailableKey as CNKeyDescriptor,CNContactThumbnailImageDataKey as CNKeyDescriptor,CNContactImageDataKey as CNKeyDescriptor,CNContactPhoneNumbersKey as CNKeyDescriptor]) {
                              var mutableContact = contact
          Severity: Minor
          Found in Pod/Classes/EVContactsPickerViewController.swift - About 2 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

          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 getContactsFromAddressBook has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                func getContactsFromAddressBook() -> Void {
                    
                    self.contacts = []
                    var mutableContacts : [EVContact] = []
                    
            Severity: Minor
            Found in Pod/Classes/EVContactsPickerViewController.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 tableView has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                open func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
            
                    guard let filteredContacts = self.filteredContacts else {
                        return nil
                    }
            Severity: Minor
            Found in Pod/Classes/EVContactsPickerViewController.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 tableView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                open func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
            
                    guard let filteredContacts = self.filteredContacts else {
                        return nil
                    }
            Severity: Minor
            Found in Pod/Classes/EVContactsPickerViewController.swift - About 1 hr to fix

              Function tableView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                      let cellIdentifier = "contactCell"
                      let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier) as! EVContactsPickerTableViewCell
                      
                      guard let selectedContacts = self.selectedContacts, let filteredContacts = self.filteredContacts else {
              Severity: Minor
              Found in Pod/Classes/EVContactsPickerViewController.swift - About 1 hr to fix

                Function viewDidLoad has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    override open func viewDidLoad() {
                        super.viewDidLoad()
                        
                        barButton = UIBarButtonItem(title: Bundle.evLocalizedStringForKey("Done"), style: .done, target: self, action: #selector(EVContactsPickerViewController.done(_:)))
                        barButton?.isEnabled = false
                Severity: Minor
                Found in Pod/Classes/EVContactsPickerViewController.swift - About 1 hr to fix

                  Function getContactsFromAddressBook has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      func getContactsFromAddressBook() -> Void {
                          
                          self.contacts = []
                          var mutableContacts : [EVContact] = []
                          
                  Severity: Minor
                  Found in Pod/Classes/EVContactsPickerViewController.swift - About 1 hr to fix

                    Function contactPickerTextViewDidChange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        func contactPickerTextViewDidChange(_ textViewText: String) -> Void {
                            if(textViewText == "") {
                                self.filteredContacts = self.contacts
                            } else {
                                guard let contacts = self.contacts else { return }
                    Severity: Minor
                    Found in Pod/Classes/EVContactsPickerViewController.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 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 refreshContact has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          func refreshContact(_ contact: EVContactProtocol) {
                              if( self.useExternal == false ) {
                                  do {
                                      if let tmpContact = try self.store?.unifiedContact(withIdentifier: contact.identifier, keysToFetch: [CNContactEmailAddressesKey as CNKeyDescriptor,CNContactGivenNameKey as CNKeyDescriptor,CNContactFamilyNameKey as CNKeyDescriptor,CNContactImageDataAvailableKey as CNKeyDescriptor,CNContactThumbnailImageDataKey as CNKeyDescriptor,CNContactImageDataKey as CNKeyDescriptor,CNContactPhoneNumbersKey as CNKeyDescriptor]) {
                                          var mutableContact = contact
                      Severity: Minor
                      Found in Pod/Classes/EVContactsPickerViewController.swift - About 1 hr to fix

                        Function tableView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                                let cellIdentifier = "contactCell"
                                let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier) as! EVContactsPickerTableViewCell
                                
                                guard let selectedContacts = self.selectedContacts, let filteredContacts = self.filteredContacts else {
                        Severity: Minor
                        Found in Pod/Classes/EVContactsPickerViewController.swift - About 55 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 updateTitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            func updateTitle() -> Void {
                                var contactsPresented = false
                                if let theContacts = self.selectedContacts {
                                    contactsPresented = theContacts.isEmpty
                                }
                        Severity: Minor
                        Found in Pod/Classes/EVContactsPickerViewController.swift - About 55 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 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

                        Severity
                        Category
                        Status
                        Source
                        Language