TheFlow0360/criteria_operator-ui_component

View on GitHub

Showing 3 of 11 total issues

Method change_sub_group_type has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def change_sub_group_type(root_op, locator, op_type)
        op = root_op
        last_pos = -1
        parent_op = nil
        locator_array = locator.split(',')
Severity: Minor
Found in app/controllers/criteria_operator/ui_component/ajax_controller.rb - About 1 hr to fix

    Method show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def show(options = {})
            @allow_delete = options.has_key?(:allow_delete) ? options[:allow_delete] : true
            @locator = options.has_key?(:locator) ? options[:locator] : ''
            if model.kind_of? GroupOperator
              @group = model
    Severity: Minor
    Found in app/cells/criteria_operator/ui_component/group_cell.rb - 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

    Method change_sub_group_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def change_sub_group_type(root_op, locator, op_type)
            op = root_op
            last_pos = -1
            parent_op = nil
            locator_array = locator.split(',')
    Severity: Minor
    Found in app/controllers/criteria_operator/ui_component/ajax_controller.rb - About 25 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