Sha256: d56dbc41f29c7d0478c3ed80d4199ed0f247fb4d40fe1fffa734ab69309dab84

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

# encoding: utf-8
# 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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.36.0 lib/rubocop/cop/mixin/min_body_length.rb