rubocop-hq/rubocop

View on GitHub
lib/rubocop/cop/layout/indentation_width.rb

Summary

Maintainability
B
6 hrs
Test Coverage
A
99%

Class IndentationWidth has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

      class IndentationWidth < Base # rubocop:disable Metrics/ClassLength
        include EndKeywordAlignment
        include Alignment
        include CheckAssignment
        include AllowedPattern
Severity: Minor
Found in lib/rubocop/cop/layout/indentation_width.rb - About 4 hrs to fix

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

            def indentation_to_check?(base_loc, body_node)
              return false if skip_check?(base_loc, body_node)
    
              if body_node.rescue_type?
                check_rescue?(body_node)
    Severity: Minor
    Found in lib/rubocop/cop/layout/indentation_width.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 check_assignment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def check_assignment(node, rhs)
              # If there are method calls chained to the right hand side of the
              # assignment, we let rhs be the receiver of those method calls before
              # we check its indentation.
              rhs = first_part_of_call_chain(rhs)
    Severity: Minor
    Found in lib/rubocop/cop/layout/indentation_width.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

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

            def offense(body_node, indentation, style)
              # This cop only autocorrects the first statement in a def body, for
              # example.
              body_node = body_node.children.first if body_node.begin_type? && !parentheses?(body_node)
    
    
    Severity: Minor
    Found in lib/rubocop/cop/layout/indentation_width.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

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

            def select_check_member(member)
              return unless member
    
              if access_modifier?(member.children.first)
                return if access_modifier_indentation_style == 'outdent'
    Severity: Minor
    Found in lib/rubocop/cop/layout/indentation_width.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

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

            def on_send(node)
              super
              return unless node.adjacent_def_modifier?
    
              def_end_config = config.for_cop('Layout/DefEndAlignment')
    Severity: Minor
    Found in lib/rubocop/cop/layout/indentation_width.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

    There are no issues that match your filters.

    Category
    Status