lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb
Class HeredocArgumentClosingParenthesis
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class HeredocArgumentClosingParenthesis < Base
include RangeHelp
extend AutoCorrector
MSG = 'Put the closing parenthesis for a method call with a ' \
Method on_send
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def on_send(node)
heredoc_arg = extract_heredoc_argument(node)
return unless heredoc_arg
outermost_send = outermost_send_on_same_line(heredoc_arg)
- Read upRead up
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
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?
- Read upRead up
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
Open
return if exist_argument_between_heredoc_end_and_closing_parentheses?(node)