stanwood/Stanwood_Debugger_iOS

View on GitHub

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)"
Severity: Minor
Found in Sources/Harlow/Extensions/UIView+Extension.swift - About 1 hr to fix

    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()
    Severity: Minor
    Found in Sources/Harlow/Modules/Settings/SettingsActionable.swift - About 1 hr to fix

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

          override func viewDidLoad() {
              super.viewDidLoad()
              
              exampleType = ExampleType(rawValue: tabBarController!.selectedIndex)!
              
      Severity: Minor
      Found in Example/Harlow/Modules/ExampleDebuggers/ExampleViewController.swift - About 1 hr to fix

        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 {
        Severity: Minor
        Found in Sources/Harlow/Extensions/UIView+Extension.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 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:
        Severity: Minor
        Found in Sources/Harlow/Modules/Settings/SettingsActionable.swift - About 1 hr to fix

          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 {
          Severity: Minor
          Found in Sources/Harlow/Extensions/UIView+Extension.swift - About 1 hr to fix

            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)
                    
            Severity: Minor
            Found in Sources/Harlow/Modules/Bubble/Views/DebuggerUIButton.swift - About 1 hr to fix

              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
              Severity: Minor
              Found in Sources/Harlow/Modules/List/ListPresenter.swift - About 1 hr to fix

                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 {
                Severity: Minor
                Found in Sources/Harlow/Extensions/UIViewController+TopMost.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 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)
                        }
                        
                Severity: Minor
                Found in Sources/Harlow/Controller/DebuggerCoordinator.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 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 {
                Severity: Minor
                Found in Sources/Harlow/Extensions/UIView+Extension.swift - About 35 mins to fix

                  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 {
                  Severity: Minor
                  Found in Sources/Harlow/Extensions/UIView+Extension.swift - About 35 mins to fix

                    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 }
                            
                    Severity: Minor
                    Found in Sources/Harlow/Views/Filter/FilterUIButton.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 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
                    Severity: Minor
                    Found in Sources/Harlow/Modules/List/ListPresenter.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 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
                    Severity: Minor
                    Found in Sources/Harlow/Modules/Bubble/Views/DebuggerUIButton.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

                    Avoid too many return statements within this function.
                    Open

                                    return .bottomRight
                    Severity: Major
                    Found in Sources/Harlow/Modules/Bubble/Views/DebuggerUIButton.swift - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return .centerLeft
                      Severity: Major
                      Found in Sources/Harlow/Modules/Bubble/Views/DebuggerUIButton.swift - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return .bottomLeft
                        Severity: Major
                        Found in Sources/Harlow/Modules/Bubble/Views/DebuggerUIButton.swift - About 30 mins to fix

                          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)
                          Severity: Minor
                          Found in Sources/Harlow/Controller/DebuggerCoordinator.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