hackiftekhar/IQKeyboardManager

View on GitHub

Showing 121 of 244 total issues

Avoid deeply nested control flow statements.
Open

                        if !previousCellRect.isEmpty {
                            let superview: UIView? = rootController.view.superview
                            let previousCellRectInRootSuperview: CGRect = collectionView.convert(previousCellRect,
                                                                                                 to: superview)

    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

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

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

        Avoid deeply nested control flow statements.
        Open

                                    if animatedContentOffset {
                                        scrollView.setContentOffset(newContentOffset, animated: UIView.areAnimationsEnabled)
                                    } else {
                                        scrollView.contentOffset = newContentOffset
                                    }

          Avoid deeply nested control flow statements.
          Open

                                  if view.isScrollEnabled, !view.iq.ignoreScrollingAdjustment {
                                      nextScrollView = view
                                      break
                                  } else {
                                      tempScrollView = view.iq.superviewOf(type: UIScrollView.self)

            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

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

                  func addToolbar(target: AnyObject?,
                                  previousConfiguration: IQBarButtonItemConfiguration? = nil,
                                  nextConfiguration: IQBarButtonItemConfiguration? = nil,
                                  rightConfiguration: IQBarButtonItemConfiguration? = nil,
                                  title: String?,
              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.

                  Avoid deeply nested control flow statements.
                  Open

                                          if !scrollView.contentOffset.equalTo(newContentOffset) {
                  
                                              showLog("""
                                                      old contentOffset: \(scrollView.contentOffset)
                                                      new contentOffset: \(newContentOffset)

                    Function addRightButtonOnKeyboardWithImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        func addRightButtonOnKeyboardWithImage(_ image: UIImage,
                                                               target: AnyObject?,
                                                               action: Selector,
                                                               shouldShowPlaceholder: Bool = false,
                                                               titleAccessibilityLabel: String? = nil) {

                      Function addRightButtonOnKeyboardWithImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          func addRightButtonOnKeyboardWithImage(_ image: UIImage,
                                                                 target: AnyObject?,
                                                                 action: Selector,
                                                                 titleText: String?,
                                                                 titleAccessibilityLabel: String? = nil) {

                        Function addCancelDoneOnKeyboardWithTarget has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?,
                                                                   cancelAction: Selector,
                                                                   doneAction: Selector,
                                                                   titleText: String?,
                                                                   titleAccessibilityLabel: String? = nil) {

                          Function addRightLeft has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              func addRightLeft(target: AnyObject?,
                                                rightConfiguration: IQBarButtonItemConfiguration, leftConfiguration: IQBarButtonItemConfiguration,
                                                title: String?, titleAccessibilityLabel: String? = nil) {
                          Severity: Minor
                          Found in IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift - About 35 mins to fix

                            Function addRightButtonOnKeyboardWithText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                func addRightButtonOnKeyboardWithText(_ text: String,
                                                                      target: AnyObject?,
                                                                      action: Selector,
                                                                      shouldShowPlaceholder: Bool = false,
                                                                      titleAccessibilityLabel: String? = nil) {

                              Function addRightButtonOnKeyboardWithText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  func addRightButtonOnKeyboardWithText(_ text: String,
                                                                        target: AnyObject?,
                                                                        action: Selector,
                                                                        titleText: String?,
                                                                        titleAccessibilityLabel: String? = nil) {

                                Function addCancelDoneOnKeyboardWithTarget has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?,
                                                                           cancelAction: Selector,
                                                                           doneAction: Selector,
                                                                           shouldShowPlaceholder: Bool = false,
                                                                           titleAccessibilityLabel: String? = nil) {

                                  Function addRightLeft has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      func addRightLeft(target: AnyObject?,
                                                        rightConfiguration: IQBarButtonItemConfiguration, leftConfiguration: IQBarButtonItemConfiguration,
                                                        showPlaceholder: Bool = false, titleAccessibilityLabel: String? = nil) {
                                  Severity: Minor
                                  Found in IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift - About 35 mins to fix

                                    Function textView has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        @objc public func textView(_ textView: UITextView,
                                                                   shouldChangeTextIn range: NSRange,
                                                                   replacementText text: String) -> Bool {
                                    
                                            var isReturn = true

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

                                        func responderSiblings() -> [UIView] {
                                    
                                            // Array of (UITextField/UITextView's).
                                            var tempTextFields: [UIView] = []
                                    
                                    
                                    Severity: Minor
                                    Found in IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.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 restore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        @discardableResult
                                        func restore(for textFieldView: UIView?) -> Bool {
                                            var success: Bool = false
                                    
                                            if scrollView.contentInset != self.startingContentInset {
                                    Severity: Minor
                                    Found in IQKeyboardManagerSwift/Configuration/IQScrollViewConfiguration.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language