hackiftekhar/IQKeyboardManager

View on GitHub

Showing 121 of 244 total issues

Function adjustPosition has a Cognitive Complexity of 164 (exceeds 5 allowed). Consider refactoring.
Open

    internal func adjustPosition() {

        //  We are unable to get textField object while keyboard showing on WKWebView's textField.  (Bug ID: #11)
        guard UIApplication.shared.applicationState == .active,
              let textFieldView: UIView = activeConfiguration.textFieldViewInfo?.textFieldView,

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 adjustPosition has 329 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    internal func adjustPosition() {

        //  We are unable to get textField object while keyboard showing on WKWebView's textField.  (Bug ID: #11)
        guard UIApplication.shared.applicationState == .active,
              let textFieldView: UIView = activeConfiguration.textFieldViewInfo?.textFieldView,

    Function tableView has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

        override func tableView(_ tableView: UITableView,
                                cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
            switch indexPath.section {
            case 0:
    Severity: Minor
    Found in Demo/Swift_Demo/ViewController/SettingsViewController+TableView.swift - About 1 day 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 tableView has 225 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        override func tableView(_ tableView: UITableView,
                                cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
            switch indexPath.section {
            case 0:
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/SettingsViewController+TableView.swift - About 1 day to fix

      File IQKeyboardManager+Position.swift has 462 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import UIKit
      
      // swiftlint:disable file_length
      @available(iOSApplicationExtension, unavailable)
      public extension IQKeyboardManager {

        Function addToolbarIfRequired has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            internal func addToolbarIfRequired() {
        
                // Either there is no inputAccessoryView or
                // if accessoryView is not appropriate for current situation
                // (There is Previous/Next/Done toolbar)

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

            internal func restorePosition() {
        
                //  Setting rootViewController frame to it's original position. //  (Bug ID: #18)
                guard let configuration: IQRootControllerConfiguration = activeConfiguration.rootControllerConfiguration 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 addToolbarIfRequired has 123 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            internal func addToolbarIfRequired() {
        
                // Either there is no inputAccessoryView or
                // if accessoryView is not appropriate for current situation
                // (There is Previous/Next/Done toolbar)

          Function addToolbar has a Cognitive Complexity of 24 (exceeds 5 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 3 hrs 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 privateResignOnTouchOutside has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              func privateResignOnTouchOutside() -> Bool {
          
                  var isEnabled: Bool = resignOnTouchOutside
          
                  guard let textFieldViewInfo: IQTextFieldViewInfo = activeConfiguration.textFieldViewInfo else {

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

              func privateIsEnabled() -> Bool {
          
                  var isEnabled: Bool = enable
          
                  guard let textFieldViewInfo: IQTextFieldViewInfo = activeConfiguration.textFieldViewInfo else {

          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 SettingsViewController+TableView.swift has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import UIKit
          import IQKeyboardManagerSwift
          
          extension SettingsViewController {
          
          
          Severity: Minor
          Found in Demo/Swift_Demo/ViewController/SettingsViewController+TableView.swift - About 2 hrs to fix

            Function parentContainerViewController has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                func parentContainerViewController() -> UIViewController? {
            
                    var matchController: UIViewController? = viewContainingController()
                    var parentContainerViewController: UIViewController?
            
            
            Severity: Minor
            Found in IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.swift - About 2 hrs 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 restorePosition has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                internal func restorePosition() {
            
                    //  Setting rootViewController frame to it's original position. //  (Bug ID: #18)
                    guard let configuration: IQRootControllerConfiguration = activeConfiguration.rootControllerConfiguration else {
                        return

              Function updateReturnKeyTypeOnTextField has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  internal func updateReturnKeyTypeOnTextField(_ view: UIView) {
                      var superConsideredView: UIView?
              
                      // If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)
                      for allowedClasse in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {

              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 searchForText has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 addToolbar has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func addToolbar(target: AnyObject?,
                                  previousConfiguration: IQBarButtonItemConfiguration? = nil,
                                  nextConfiguration: IQBarButtonItemConfiguration? = nil,
                                  rightConfiguration: IQBarButtonItemConfiguration? = nil,
                                  title: String?,
              Severity: Major
              Found in IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift - About 2 hrs to fix

                Function viewDidLoad has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    override func viewDidLoad() {
                        super.viewDidLoad()
                
                        // Get the item[s] we're handling from the extension context.
                        // For example, look for an image and place it into an image view.
                Severity: Minor
                Found in DemoExtension/ActionViewController.swift - About 2 hrs 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 prepare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
                
                        guard let identifier = segue.identifier else {
                            return
                        }
                Severity: Minor
                Found in Demo/Swift_Demo/ViewController/SettingsViewController.swift - About 2 hrs 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 responderViews has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    func responderViews() -> [UIView]? {
                
                        guard let textFieldView: UIView = activeConfiguration.textFieldViewInfo?.textFieldView else {
                            return 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

                Severity
                Category
                Status
                Source
                Language