Sha256: 6fc7446fec5d3cd36dd3bedcd3a6fea22de7ae8a368a900ea3004e9a8bdaf0c9

Contents?: true

Size: 850 Bytes

Versions: 12

Compression:

Stored size: 850 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([:defn], 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

12 entries across 12 versions & 2 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.4.0 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.5.0 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.5.1 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.5.2 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.5.3 lib/simplabs/excellent/checks/method_line_count_check.rb
excellent-1.5.4 lib/simplabs/excellent/checks/method_line_count_check.rb