Sha256: d94723fe844c62ba0360a36d5cd2aba7104c67e1e9586e883a6525659d0892d8

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

require 'roodi/checks/check'

module Roodi
  module Checks
    class LineCountCheck < Check
      def initialize(interesting_nodes, line_count, message_prefix)
        super()
        @interesting_nodes = interesting_nodes
        @line_count = line_count
        @message_prefix = message_prefix
      end

      def interesting_nodes
        @interesting_nodes
      end

      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

      protected
  
      def count_lines(node)
        node.last.line - node.line - 1
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
roodi1.9-2.0.1 lib/roodi/checks/line_count_check.rb
roodi-2.1.0 lib/roodi/checks/line_count_check.rb
roodi-2.0.1 lib/roodi/checks/line_count_check.rb
roodi-2.0.0 lib/roodi/checks/line_count_check.rb