hackiftekhar/IQKeyboardManager

View on GitHub

Showing 121 of 244 total issues

Function searchForText has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func searchForText(_ searchText: String?, scope: Int) {

        guard let text = searchText, !text.isEmpty else {
            self.filteredList = self.dataList
            return
Severity: Minor
Found in Demo/Swift_Demo/ViewController/SearchViewController.swift - About 1 hr to fix

    Function setupTextFieldView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func setupTextFieldView() {
    
            guard let textFieldView = activeConfiguration.textFieldViewInfo?.textFieldView else {
                return
            }

      Function updateRootController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private func updateRootController(info: IQTextFieldViewInfo?) {
      
              guard let info = info,
                    let controller: UIViewController = info.textFieldView.iq.parentContainerViewController() else {
                  if let rootControllerConfiguration = rootControllerConfiguration,
      Severity: Minor
      Found in IQKeyboardManagerSwift/Configuration/IQActiveConfiguration.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 topMostController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          func topMostController() -> UIViewController? {
      
              var controllersHierarchy: [UIViewController] = []
      
              if var topController: UIViewController = base.window?.rootViewController {
      Severity: Minor
      Found in IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.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 removeToolbarIfRequired has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          internal func removeToolbarIfRequired() {    //  (Bug ID: #18)
      
              guard let siblings: [UIView] = responderViews(), !siblings.isEmpty,
                    let textField: UIView = activeConfiguration.textFieldViewInfo?.textFieldView,
                      textField.responds(to: #selector(setter: UITextField.inputAccessoryView)),

        Function addPreviousNextRightOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?,
                                                          rightButtonImage: UIImage,
                                                          previousAction: Selector,
                                                          nextAction: Selector,
                                                          rightButtonAction: Selector,

          Function addPreviousNextRightOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?,
                                                            rightButtonTitle: String,
                                                            previousAction: Selector,
                                                            nextAction: Selector,
                                                            rightButtonAction: Selector,

            Function addRightLeftOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?,
                                                      leftButtonTitle: String,
                                                      rightButtonTitle: String,
                                                      leftButtonAction: Selector,
                                                      rightButtonAction: Selector,

              Function addRightLeftOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?,
                                                        leftButtonImage: UIImage,
                                                        rightButtonImage: UIImage,
                                                        leftButtonAction: Selector,
                                                        rightButtonAction: Selector,

                Function addPreviousNextRightOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?,
                                                                  rightButtonImage: UIImage,
                                                                  previousAction: Selector,
                                                                  nextAction: Selector,
                                                                  rightButtonAction: Selector,

                  Function addPreviousNextRightOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?,
                                                                    rightButtonTitle: String,
                                                                    previousAction: Selector,
                                                                    nextAction: Selector,
                                                                    rightButtonAction: Selector,

                    Function addRightLeftOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?,
                                                              leftButtonImage: UIImage,
                                                              rightButtonImage: UIImage,
                                                              leftButtonAction: Selector,
                                                              rightButtonAction: Selector,

                      Function addRightLeftOnKeyboardWithTarget has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?,
                                                                leftButtonTitle: String,
                                                                rightButtonTitle: String,
                                                                leftButtonAction: Selector,
                                                                rightButtonAction: Selector,

                        Function textFieldShouldReturn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
                        
                                var isReturn: Bool = true
                        
                                if delegate == nil {

                        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 addPreviousNextDone has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            func addPreviousNextDone(target: AnyObject?,
                                                     previousAction: Selector, nextAction: Selector, doneAction: Selector,
                                                     title: String?, titleAccessibilityLabel: String? = nil) {
                        Severity: Minor
                        Found in IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if isScrollableTextView,
                                                      nextScrollView == nil,
                                                      suggestedOffsetY >= 0 {
                          
                                                      // Converting Rectangle according to window bounds.

                            Function addPreviousNextDoneOnKeyboardWithTarget has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                func addPreviousNextDoneOnKeyboardWithTarget(_ target: AnyObject?,
                                                                             previousAction: Selector,
                                                                             nextAction: Selector,
                                                                             doneAction: Selector,
                                                                             titleText: String?,

                              Function setupTextFieldView has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  func setupTextFieldView() {
                              
                                      guard let textFieldView = activeConfiguration.textFieldViewInfo?.textFieldView else {
                                          return
                                      }

                              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 addPreviousNextDone has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  func addPreviousNextDone(target: AnyObject?, previousAction: Selector, nextAction: Selector, doneAction: Selector,
                                                           showPlaceholder: Bool = false, titleAccessibilityLabel: String? = nil) {
                              Severity: Minor
                              Found in IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if animatedContentOffset {
                                                                scrollView.setContentOffset(newContentOffset, animated: UIView.areAnimationsEnabled)
                                                            } else {
                                                                scrollView.contentOffset = newContentOffset
                                                            }
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language