hackiftekhar/IQKeyboardManager

View on GitHub

Showing 121 of 244 total issues

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

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        do {
            let classes = IQKeyboardManager.shared.disabledDistanceHandlingClasses
Severity: Minor
Found in Demo/Swift_Demo/ViewController/CustomViewController.swift - About 1 hr to fix

    Function removeToolbarIfRequired has a Cognitive Complexity of 13 (exceeds 5 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)),

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

        func parentContainerViewController() -> UIViewController? {
    
            var matchController: UIViewController? = viewContainingController()
            var parentContainerViewController: UIViewController?
    
    
    Severity: Minor
    Found in IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.swift - About 1 hr to fix

      Function responderViews has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func responderViews() -> [UIView]? {
      
              guard let textFieldView: UIView = activeConfiguration.textFieldViewInfo?.textFieldView else {
                  return nil
              }

        Function deepResponderViews has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            func deepResponderViews() -> [UIView] {
        
                // Array of (UITextField/UITextView's).
                var textfields: [UIView] = []
        
        
        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 sendEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private func sendEvent() {
        
                if let textFieldViewInfo = textFieldViewInfo,
                   let rootControllerConfiguration = rootControllerConfiguration,
                   rootControllerConfiguration.isReady {
        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 goToNextResponderOrResign has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            @discardableResult
            internal func goToNextResponderOrResign(_ view: UIView) -> Bool {
        
                var superConsideredView: UIView?
        
        

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

            func superviewOf<T: UIView>(type classType: T.Type, belowView: UIView? = nil) -> T? {
        
                var superView: UIView? = base.superview
        
                while let unwrappedSuperView: UIView = superView {
        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 addKeyboardListener has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private func addKeyboardListener() {
                keyboardListener.registerSizeChange(identifier: "IQActiveConfiguration", changeHandler: { [self] name, _ in
        
                    if let info = textFieldViewInfo, keyboardInfo.keyboardShowing {
                        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 prepare has 35 lines of code (exceeds 25 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 1 hr to fix

          Function presentAction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @IBAction private func presentAction(_ sender: UIBarButtonItem) {
          
                  if self.presentingViewController == nil {
          
                      let controller = UIAlertController.init(title: nil, message: nil, preferredStyle: .actionSheet)
          Severity: Minor
          Found in Demo/Swift_Demo/ViewController/BaseViewController.swift - About 1 hr to fix

            Function presentAction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @IBAction private func presentAction(_ sender: UIBarButtonItem) {
            
                    if self.presentingViewController == nil {
            
                        let controller = UIAlertController.init(title: nil, message: nil, preferredStyle: .actionSheet)
            Severity: Minor
            Found in Demo/Swift_Demo/ViewController/BaseTableViewController.swift - About 1 hr to fix

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

                  override func viewDidLoad() {
                      super.viewDidLoad()
              
                      textView1.delegate = self
                      textView2.iq.enableMode = .disabled
              Severity: Minor
              Found in Demo/Swift_Demo/ViewController/TextFieldViewController.swift - About 1 hr to fix

                Function privateResignOnTouchOutside has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function privateIsEnabled has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function privateIsEnableAutoToolbar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        func privateIsEnableAutoToolbar() -> Bool {
                    
                            var isEnabled: Bool = enableAutoToolbar
                    
                            guard let textFieldViewInfo: IQTextFieldViewInfo = activeConfiguration.textFieldViewInfo,

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

                        override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                    
                            switch section {
                            case 0:
                                if IQKeyboardManager.shared.enable == 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 goToNextResponderOrResign has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @discardableResult
                        internal func goToNextResponderOrResign(_ view: UIView) -> Bool {
                    
                            var superConsideredView: UIView?
                    
                    

                      Function tableView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                      
                              switch section {
                              case 0:
                                  if IQKeyboardManager.shared.enable == true {

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

                            private func setupForView(in scrollView: UIScrollView) {
                                let eachHeight: CGFloat = 600
                                let gap: CGFloat = 10
                                let stackView = UIView()
                                scrollView.addSubview(stackView)
                          Severity
                          Category
                          Status
                          Source
                          Language