Sha256: 883c4f947a4919165df70abcb14432a746243a4f40e11a47d20762d2868a2571

Contents?: true

Size: 502 Bytes

Versions: 6790

Compression:

Stored size: 502 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for checking minimum body length.
    module MinBodyLength
      private

      def min_body_length?(node)
        (node.loc.end.line - node.loc.keyword.line) > min_body_length
      end

      def min_body_length
        length = cop_config['MinBodyLength'] || 1
        return length if length.is_a?(Integer) && length > 0

        raise 'MinBodyLength needs to be a positive integer!'
      end
    end
  end
end

Version data entries

6,790 entries across 6,784 versions & 25 rubygems

Version Path
rubocop-0.58.0 lib/rubocop/cop/mixin/min_body_length.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.57.2 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.57.1 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.57.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.56.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.55.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.54.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.53.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.52.1 lib/rubocop/cop/mixin/min_body_length.rb