Class: RuboCop::Cop::Metz::MethodsTooLong
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Metz::MethodsTooLong
- Extended by:
- Metz::CopMetadata
- Includes:
- AllowedMethods, AllowedPattern, CodeLength
- Defined in:
- lib/rubocop/cop/metz/methods_too_long.rb
Overview
Flags methods whose body exceeds the configured Max line count.
Wraps the semantics of core's Metrics/MethodLength with a stricter
default of 5 lines.
Constant Summary collapse
- LABEL =
"Method"
Constants included from Metz::CopMetadata
Metz::CopMetadata::DEFAULT_FIX_SAFETY, Metz::CopMetadata::DEFAULT_SUGGESTED_NEXT_MOVES, Metz::CopMetadata::DEFAULT_WHY_IT_MATTERS
Instance Method Summary collapse
- #on_block(node) ⇒ Object (also: #on_numblock, #on_itblock)
- #on_def(node) ⇒ Object (also: #on_defs)
Methods included from Metz::CopMetadata
fix_safety, included, metz_metadata, suggested_next_moves, why_it_matters
Instance Method Details
#on_block(node) ⇒ Object Also known as: on_numblock, on_itblock
35 36 37 38 39 40 |
# File 'lib/rubocop/cop/metz/methods_too_long.rb', line 35 def on_block(node) return unless node.method?(:define_method) return if defined_method_allowed?(node.send_node.first_argument) check_code_length(node) end |
#on_def(node) ⇒ Object Also known as: on_defs
28 29 30 31 32 |
# File 'lib/rubocop/cop/metz/methods_too_long.rb', line 28 def on_def(node) return if allowed?(node.method_name) check_code_length(node) end |