Showing 19 of 106 total issues
Function addInnerShadow
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult
func addInnerShadow(onSide: InnerShadowSide, shadowColor: UIColor = .black, shadowSize: CGFloat = 2, cornerRadius: CGFloat = 0.0, shadowOpacity: Float = 0.35) -> CAShapeLayer {
// define and set a shaow layer
let layerName = "shadow\(onSide.rawValue)"
Function didTap
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
func didTap(action: SettingsData.Section.SettingType) {
switch action {
case .removeAnalytics:
coordinator?.shouldReset(.analytics) { [unowned self] in
self.appData.analyticsItems.removeAll()
Function viewDidLoad
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
override func viewDidLoad() {
super.viewDidLoad()
exampleType = ExampleType(rawValue: tabBarController!.selectedIndex)!
Function shake
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@discardableResult func shake(toward edge: SimpleAnimationEdge = .none,
amount: CGFloat = 0.15,
duration: TimeInterval = 0.6,
delay: TimeInterval = 0,
completion: ((Bool) -> Void)? = nil) -> UIView {
- 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 switchDidChange
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
func switchDidChange(to value: Bool, for type: SettingsData.Section.SettingType) {
switch type {
case .storeAnalytics where value:
DebuggerSettings.shouldStoreAnalyticsData = value
case .storeAnalytics where !value:
Function shake
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@discardableResult func shake(toward edge: SimpleAnimationEdge = .none,
amount: CGFloat = 0.15,
duration: TimeInterval = 0.6,
delay: TimeInterval = 0,
completion: ((Bool) -> Void)? = nil) -> UIView {
Function panning
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@objc func panning(_ pan: UIPanGestureRecognizer) {
let translation = pan.translation(in: superview)
pan.setTranslation(.zero, in: superview)
Function viewDidLoad
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func viewDidLoad() {
viewable?.tableView.register(cells: AnalyticsCell.self, NetworkingCell.self, LogCell.self, ErrorCell.self, CrashCell.self, bundle: Bundle.debuggerBundle())
viewable?.tableView.estimatedRowHeight = 75
Function topMostViewController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@objc func topMostViewController() -> UIViewController? {
// Handling UIViewControllers added as subviews to some other views.
guard let presented = self.presentedViewController else {
for view in self.view.subviews {
- 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 currentViewController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func currentViewController(base: UIViewController?) -> UIViewController? {
if let nav = base as? UINavigationController {
return currentViewController(base: nav.visibleViewController)
}
- 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 addInnerShadow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func addInnerShadow(onSide: InnerShadowSide, shadowColor: UIColor = .black, shadowSize: CGFloat = 2, cornerRadius: CGFloat = 0.0, shadowOpacity: Float = 0.35) -> CAShapeLayer {
Function shake
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
@discardableResult func shake(toward edge: SimpleAnimationEdge = .none,
amount: CGFloat = 0.15,
duration: TimeInterval = 0.6,
delay: TimeInterval = 0,
completion: ((Bool) -> Void)? = nil) -> UIView {
Function didAddNewItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@objc private func didAddNewItem(_ notification: Notification) {
guard let addedItems = notification.object as? [AddedItem],
let addedItem = addedItems.filter({ $0.type.label == self.filter?.label }).first 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 viewDidLoad
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func viewDidLoad() {
viewable?.tableView.register(cells: AnalyticsCell.self, NetworkingCell.self, LogCell.self, ErrorCell.self, CrashCell.self, bundle: Bundle.debuggerBundle())
viewable?.tableView.estimatedRowHeight = 75
- 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 position
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static func position(for point: CGPoint) -> Positions {
if Positions.centerLeft.rect.contains(point) {
return .centerLeft
} else if Positions.centerRight.rect.contains(point) {
return .centerRight
- 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
Avoid too many return
statements within this function. Open
return .bottomRight
Avoid too many return
statements within this function. Open
return .centerLeft
Avoid too many return
statements within this function. Open
return .bottomLeft
Function present
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func present(_ item: Recordable) {
if let item = item as? NetworkItem {
present(item)
} else if let item = item as? ErrorItem {
present(item)
- 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"