class RuboCop::Cop::Metrics::MethodLength
end # 6 points
)
2
1,
foo( # +1
HEREDOC
content.
Heredoc
<<~HEREDOC # +1
}
key: ‘value’
hash = { # +3
]
2
1,
array = [ # +1
def m
@example CountAsOne: [‘array’, ‘heredoc’, ‘method_call’]
By default, there are no methods to allowed.
Please use ‘AllowedMethods` and `AllowedPatterns` instead.
deprecated and only kept for backwards compatibility.
NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is
will be counted as one line regardless of its actual size.
Available are: ’array’, ‘hash’, ‘heredoc’, and ‘method_call’. Each construct
You can set constructs you want to fold with ‘CountAsOne`.
The maximum allowed length is configurable.
Comment lines can optionally be allowed.
Checks if the length of a method exceeds some maximum value.
def cop_label
def cop_label LABEL end
def on_block(node)
def on_block(node) return unless node.send_node.method?(:define_method) check_code_length(node) end
def on_def(node)
def on_def(node) return if allowed_method?(node.method_name) || matches_allowed_pattern?(node.method_name) check_code_length(node) end