Sha256: 967d67f599f04bac8944720cde195e608ef470c56c9c314bed5ce8aed1a3c09b

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

require 'simplabs/excellent/checks/line_count_check'

module Simplabs

  module Excellent

    module Checks

      # This check reports classes which have more lines than the threshold. Classes with a large number of lines are hard to read and understand and
      # often an indicator for badly designed code as well.
      #
      # ==== Applies to
      #
      # * classes
      class ClassLineCountCheck < LineCountCheck

        DEFAULT_THRESHOLD = 400

        def initialize(options = {}) #:nodoc:
          threshold = options[:threshold] || DEFAULT_THRESHOLD
          super([Parsing::ClassContext], threshold)
        end

        protected

          def warning_args(context) #:nodoc:
            [context, '{{class}} has {{count}} lines.', { :class => context.full_name, :count => context.line_count }]
          end

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
excellent-1.6.0 lib/simplabs/excellent/checks/class_line_count_check.rb