Sha256: 19091fd8b3a010598954fef539d946f28604929f57ce9c14db89e158132f0745

Contents?: true

Size: 491 Bytes

Versions: 4

Compression:

Stored size: 491 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Lint
      # This cop checks for empty interpolation.
      #
      # @example
      #
      #   "result is #{}"
      class EmptyInterpolation < Cop
        MSG = 'Empty interpolation detected.'

        def on_dstr(node)
          node.children.select { |n| n.type == :begin }.each do |begin_node|
            add_offense(begin_node, :expression) if begin_node.children.empty?
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.22.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-0.21.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-0.20.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-0.20.0 lib/rubocop/cop/lint/empty_interpolation.rb