Sha256: 8e828b3ca1eebbdd34a6c4c9bfaf834cb8e59a41c6e27eaa618af1aac915ea03

Contents?: true

Size: 487 Bytes

Versions: 20

Compression:

Stored size: 487 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for checking minimum body length.
    module MinBodyLength
      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

20 entries across 20 versions & 2 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.52.0 lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.51.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.50.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.49.1 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.49.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.48.1 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.48.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.47.1 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.47.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.46.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.45.0 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.44.1 lib/rubocop/cop/mixin/min_body_length.rb
rubocop-0.44.0 lib/rubocop/cop/mixin/min_body_length.rb