rubocop-hq/rubocop

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

Summary

Maintainability
B
5 hrs
Test Coverage
A
100%

Class HeredocArgumentClosingParenthesis has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

      class HeredocArgumentClosingParenthesis < Base
        include RangeHelp
        extend AutoCorrector

        MSG = 'Put the closing parenthesis for a method call with a ' \
Severity: Minor
Found in lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb - About 3 hrs to fix

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

            def on_send(node)
              heredoc_arg = extract_heredoc_argument(node)
              return unless heredoc_arg
    
              outermost_send = outermost_send_on_same_line(heredoc_arg)
    Severity: Minor
    Found in lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.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 extract_heredoc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def extract_heredoc(node)
              return node if heredoc_node?(node)
              return node.receiver if single_line_send_with_heredoc_receiver?(node)
    
              return unless node.hash_type?
    Severity: Minor
    Found in lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.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

    Avoid too many return statements within this method.
    Open

              return if exist_argument_between_heredoc_end_and_closing_parentheses?(node)
    Severity: Major
    Found in lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status