hackiftekhar/IQKeyboardManager

View on GitHub

Showing 244 of 244 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    @available(iOSApplicationExtension, unavailable)
    @MainActor
    private struct AssociatedKeys {
        static var ignoreScrollingAdjustment: Int = 0
        static var ignoreContentInsetAdjustment: Int = 0
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift on lines 26..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    @available(iOSApplicationExtension, unavailable)
    @MainActor
    private struct AssociatedKeys {
        static var toolbar: Int = 0
        static var hidePlaceholder: Int = 0
    IQKeyboardManagerSwift/UIKitExtensions/IQUIScrollView+Additions.swift on lines 26..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @available(*, unavailable, renamed: "iq.addRightLeft(target:rightConfiguration:leftConfiguration:showPlaceholder:titleAccessibilityLabel:)")
        func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?,
                                               cancelAction: Selector,
                                               doneAction: Selector,
                                               shouldShowPlaceholder: Bool = false,
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift on lines 254..261

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @available(*, unavailable, renamed: "iq.addRightLeft(target:rightConfiguration:leftConfiguration:title:titleAccessibilityLabel:)")
        func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?,
                                               cancelAction: Selector,
                                               doneAction: Selector,
                                               titleText: String?,
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift on lines 263..269

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        func addPreviousNextRight(target: AnyObject?,
                                  previousConfiguration: IQBarButtonItemConfiguration? = nil,
                                  nextConfiguration: IQBarButtonItemConfiguration? = nil,
                                  rightConfiguration: IQBarButtonItemConfiguration?,
                                  showPlaceholder: Bool = false, titleAccessibilityLabel: String? = nil) {
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift on lines 298..304

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        func addRightLeft(target: AnyObject?,
                          rightConfiguration: IQBarButtonItemConfiguration, leftConfiguration: IQBarButtonItemConfiguration,
                          showPlaceholder: Bool = false, titleAccessibilityLabel: String? = nil) {
            let title: String? = showPlaceholder ? drawingPlaceholder : nil
            addRightLeft(target: target,
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbarDeprecated.swift on lines 112..118

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        func addRightLeft(target: AnyObject?,
                          rightConfiguration: IQBarButtonItemConfiguration, leftConfiguration: IQBarButtonItemConfiguration,
                          title: String?, titleAccessibilityLabel: String? = nil) {
            addToolbar(target: target,
                       previousConfiguration: leftConfiguration, rightConfiguration: rightConfiguration,
    IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbarDeprecated.swift on lines 140..146

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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 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

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    //
    //  IQUIView+Hierarchy.swift
    //  https://github.com/hackiftekhar/IQKeyboardManager
    //  Copyright (c) 2013-24 Iftekhar Qurashi.
    //
    Severity: Minor
    Found in IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.swift and 1 other location - About 35 mins to fix
    IQKeyboardManagerSwift/UIKitExtensions/IQUIView+Hierarchy.swift on lines 1..354

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        func handleKeyboardTextFieldViewVisible() {
            if self.activeConfiguration.rootControllerConfiguration == nil {    //  (Bug ID: #5)
    
                let rootConfiguration: IQRootControllerConfiguration? = self.activeConfiguration.rootControllerConfiguration
                if let gestureConfiguration = self.rootConfigurationWhilePopGestureActive,

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @objc func enableAutoToolbarAction (_ sender: UISwitch) {
    
            IQKeyboardManager.shared.enableAutoToolbar = sender.isOn
    
            self.tableView.reloadSections(IndexSet(integer: 1), with: .fade)
    Severity: Minor
    Found in Demo/Swift_Demo/ViewController/SettingsViewController.swift and 1 other location - About 35 mins to fix
    Demo/Swift_Demo/ViewController/SettingsViewController.swift on lines 81..86

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        @objc func enableAction (_ sender: UISwitch) {
    
            IQKeyboardManager.shared.enable = sender.isOn
    
            self.tableView.reloadSections(IndexSet(integer: 0), with: .fade)
    Severity: Minor
    Found in Demo/Swift_Demo/ViewController/SettingsViewController.swift and 1 other location - About 35 mins to fix
    Demo/Swift_Demo/ViewController/SettingsViewController.swift on lines 103..108

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

            do {
                let classes = IQKeyboardManager.shared.enabledTouchResignedClasses
                switchEnableTouchResign.isOn = classes.contains(where: { element in
                    return element == CustomViewController.self
                })
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/CustomViewController.swift and 6 other locations - About 35 mins to fix
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 64..69
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 71..76
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 78..83
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 85..90
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 92..97
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 106..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 43.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

            do {
                let classes = IQKeyboardManager.shared.disabledToolbarClasses
                switchDisableToolbar.isOn = classes.contains(where: { element in
                    return element == CustomViewController.self
                })
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/CustomViewController.swift and 6 other locations - About 35 mins to fix
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 64..69
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 71..76
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 85..90
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 92..97
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 99..104
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 106..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 43.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

            do {
                let classes = IQKeyboardManager.shared.enabledDistanceHandlingClasses
                switchEnableViewController.isOn = classes.contains(where: { element in
                    return element == CustomViewController.self
                })
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/CustomViewController.swift and 6 other locations - About 35 mins to fix
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 64..69
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 78..83
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 85..90
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 92..97
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 99..104
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 106..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 43.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

            do {
                let classes = IQKeyboardManager.shared.disabledDistanceHandlingClasses
                switchDisableViewController.isOn = classes.contains(where: { element in
                    return element == CustomViewController.self
                })
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/CustomViewController.swift and 6 other locations - About 35 mins to fix
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 71..76
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 78..83
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 85..90
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 92..97
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 99..104
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 106..111

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 43.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

            do {
                let classes = IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses
                switchAllowPreviousNext.isOn = classes.contains(where: { element in
                    return element == IQPreviousNextView.self
                })
    Severity: Major
    Found in Demo/Swift_Demo/ViewController/CustomViewController.swift and 6 other locations - About 35 mins to fix
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 64..69
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 71..76
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 78..83
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 85..90
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 92..97
    Demo/Swift_Demo/ViewController/CustomViewController.swift on lines 99..104

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 43.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language