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
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! {
- Read upRead up
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
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! {
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
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
- Read upRead up
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?
Function getContactsFromAddressBook
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
func getContactsFromAddressBook() -> Void {
self.contacts = []
var mutableContacts : [EVContact] = []
- Read upRead up
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
}
- Read upRead up
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
}
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 {
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
Function getContactsFromAddressBook
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
func getContactsFromAddressBook() -> Void {
self.contacts = []
var mutableContacts : [EVContact] = []
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 }
- Read upRead up
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 = []
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! {
- Read upRead up
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
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 {
- Read upRead up
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
}
- Read upRead up
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
- Read upRead up
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"