class RuboCop::Cop::Metrics::ModuleLength

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Public Instance Methods

on_casgn(node) click to toggle source
# File lib/rubocop/cop/metrics/module_length.rb, line 16
def on_casgn(node)
  module_definition?(node) do
    check_code_length(node)
  end
end
on_module(node) click to toggle source
# File lib/rubocop/cop/metrics/module_length.rb, line 12
def on_module(node)
  check_code_length(node)
end

Private Instance Methods

message(length, max_length) click to toggle source
# File lib/rubocop/cop/metrics/module_length.rb, line 28
def message(length, max_length)
  format('Module has too many lines. [%<length>d/%<max>d]',
         length: length,
         max: max_length)
end