Sha256: d3b021ea07db82ec41c05898682711c87f273f1ebd7ad19c2ce604951b435c66

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Metrics
      # This cop checks if the length of a method exceeds some maximum value.
      # Comment lines can optionally be ignored.
      # The maximum allowed length is configurable.
      class MethodLength < Cop
        include TooManyLines

        LABEL = 'Method'.freeze

        def on_def(node)
          check_code_length(node)
        end
        alias on_defs on_def

        def on_block(node)
          return unless node.send_node.method_name == :define_method

          check_code_length(node)
        end

        private

        def cop_label
          LABEL
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.59.1 lib/rubocop/cop/metrics/method_length.rb
rubocop-0.59.0 lib/rubocop/cop/metrics/method_length.rb