Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::CodeLength

Common functionality for checking length of code segments.

Public Instance Methods

check(node, *_) click to toggle source
# File lib/rubocop/cop/mixin/code_length.rb, line 16
def check(node, *_)
  length = code_length(node)
  return unless length > max_length

  add_offense(node, :keyword, format(message, length,
                                     max_length)) do
    self.max = length
  end
end
count_comments?() click to toggle source
# File lib/rubocop/cop/mixin/code_length.rb, line 12
def count_comments?
  cop_config['CountComments']
end
irrelevant_line(source_line) click to toggle source

Returns true for lines that shall not be included in the count.

# File lib/rubocop/cop/mixin/code_length.rb, line 27
def irrelevant_line(source_line)
  source_line.blank? || !count_comments? && comment_line?(source_line)
end
max_length() click to toggle source
# File lib/rubocop/cop/mixin/code_length.rb, line 8
def max_length
  cop_config['Max']
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.