123456789_123456789_123456789_123456789_123456789_

Module: RuboCop::Cop::MinBodyLength

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rubocop/cop/mixin/min_body_length.rb

Overview

Common functionality for checking minimum body length.

Instance Method Summary

Instance Method Details

#min_body_length (private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/min_body_length.rb', line 13

def min_body_length
  length = cop_config['MinBodyLength'] || 1
  return length if length.is_a?(Integer) && length.positive?

  raise 'MinBodyLength needs to be a positive integer!'
end

#min_body_length?(node) ⇒ Boolean (private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/min_body_length.rb', line 9

def min_body_length?(node)
  (node.loc.end.line - node.loc.keyword.line) > min_body_length
end