Sha256: 0a20d6d1e70143ac9e9f8796defbf6a78b546dc21a1345504bbbf38669935e7a

Contents?: true

Size: 858 Bytes

Versions: 4

Compression:

Stored size: 858 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:
          options[:threshold] ||= DEFAULT_THRESHOLD
          super([Parsing::MethodContext], options)
        end

        protected

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

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
excellent-2.1.1 lib/simplabs/excellent/checks/method_line_count_check.rb
excellent-2.1.0 lib/simplabs/excellent/checks/method_line_count_check.rb
excellent-2.0.1 lib/simplabs/excellent/checks/method_line_count_check.rb
excellent-2.0.0 lib/simplabs/excellent/checks/method_line_count_check.rb