Class: Roodi::Checks::LineCountCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/roodi/checks/line_count_check.rb

Overview

Checks how many lines there are in a ruby_parser node

Constant Summary

Constants inherited from Check

Check::NODE_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Check

#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #initialize, make, #position, #start_file

Constructor Details

This class inherits a constructor from Roodi::Checks::Check

Instance Attribute Details

#line_countObject

Returns the value of attribute line_count.



8
9
10
# File 'lib/roodi/checks/line_count_check.rb', line 8

def line_count
  @line_count
end

Instance Method Details

#evaluate_start(node) ⇒ Object



10
11
12
13
# File 'lib/roodi/checks/line_count_check.rb', line 10

def evaluate_start(node)
  line_count = count_lines(node)
  add_error "#{message_prefix} \"#{node[1]}\" has #{line_count} lines.  It should have #{@line_count} or less." unless line_count <= @line_count
end