Sha256: 3aaf968f9e174988a13933c354030a8e220a54ceb91da187b4f41315379808fb
Contents?: true
Size: 968 Bytes
Versions: 3
Compression:
Stored size: 968 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks if the length a method exceeds some maximum value. # Comment lines can optionally be ignored. # The maximum allowed length is configurable. class MethodLength < Cop MSG = 'Method has too many lines. [%d/%d]' def on_def(node) check(node) end def on_defs(node) check(node) end def max_length cop_config['Max'] end def count_comments? cop_config['CountComments'] end private def check(node) method_length = Util.source_length(node.loc.expression.source, count_comments?) if method_length > max_length message = sprintf(MSG, method_length, max_length) convention(node, :keyword, message) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.15.0 | lib/rubocop/cop/style/method_length.rb |
rubocop-0.14.1 | lib/rubocop/cop/style/method_length.rb |
rubocop-0.14.0 | lib/rubocop/cop/style/method_length.rb |