Sha256: 02b9916eabdb5f00f86efc0088a3396b42037c0e32c4c07d2a795cffd3841133

Contents?: true

Size: 609 Bytes

Versions: 9

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # Checks for empty interpolation.
      #
      # @example
      #
      #   # bad
      #   "result is #{}"
      #
      #   # 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) }
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubocop-1.70.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.69.2 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.69.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.69.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.68.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.67.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.66.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.66.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.65.1 lib/rubocop/cop/lint/empty_interpolation.rb