Sha256: 4507beaae7898b918a814fcf1003d7a06aefa2835cbbf67f2e6cbe34d0d8cb69

Contents?: true

Size: 867 Bytes

Versions: 1

Compression:

Stored size: 867 Bytes

Contents

require 'simplabs/excellent/checks/line_count_check'

module Simplabs

  module Excellent

    module Checks

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

        DEFAULT_THRESHOLD = 20

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

        protected

          def warning_args(context) #:nodoc:
            [context, '{{method}} has {{count}} lines.', { :method => 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/method_line_count_check.rb