edwardvalentini/EVContactsPicker

View on GitHub

Showing 24 of 33 total issues

Function viewDidLoad has a Cognitive Complexity of 7 (exceeds 5 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 35 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 didChooseContacts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    func didChooseContacts(_ contacts: [EVContactProtocol]?) {
        var conlist : String = ""
        if let cons = contacts {
            for con in cons {
                if let fullname = con.fullname() {
Severity: Minor
Found in Example/EVContactsPicker/DemoViewController.swift - About 35 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 done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @objc open func done(_ sender: AnyObject) -> Void {
        let delayTime = DispatchTime.now() + Double(Int64(0.01 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)

        DispatchQueue.main.asyncAfter(deadline: delayTime, execute: { () -> Void in
            if let del = self.delegate {
Severity: Minor
Found in Pod/Classes/EVContactsPickerViewController.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

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

Severity
Category
Status
Source
Language