Sha256: 794e53e0ad618a9326417f7e6633fce205ee62621b6c4fe18c823af877732fd9

Contents?: true

Size: 663 Bytes

Versions: 4

Compression:

Stored size: 663 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # Checks for empty interpolation.
      #
      # @example
      #
      #   # bad
      #
      #   "result is #{}"
      #
      # @example
      #
      #   # good
      #
      #   "result is #{some_result}"
      class EmptyInterpolation < Base
        include Interpolation
        extend AutoCorrector

        MSG = 'Empty interpolation detected.'

        def on_interpolation(begin_node)
          return unless begin_node.children.empty?

          add_offense(begin_node) { |corrector| corrector.remove(begin_node.source_range) }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
call_your_name-0.1.0 vendor/bundle/ruby/3.1.0/gems/rubocop-1.48.1/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.48.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.48.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.47.0 lib/rubocop/cop/lint/empty_interpolation.rb