Sha256: 59946577ff4c8ba9e8d22518de78b865c6a0c6fd878d7f2744a13f869e9b3c2f

Contents?: true

Size: 650 Bytes

Versions: 142

Compression:

Stored size: 650 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) }
        end
      end
    end
  end
end

Version data entries

142 entries across 141 versions & 15 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/lint/empty_interpolation.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.65.0 lib/rubocop/cop/lint/empty_interpolation.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-1.64.1/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.64.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.63.4 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.63.3 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.63.2 lib/rubocop/cop/lint/empty_interpolation.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.63.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.63.0 lib/rubocop/cop/lint/empty_interpolation.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.62.1 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.62.0 lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.61.0 lib/rubocop/cop/lint/empty_interpolation.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.2/lib/rubocop/cop/lint/empty_interpolation.rb
rubocop-1.60.2 lib/rubocop/cop/lint/empty_interpolation.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/lint/empty_interpolation.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/lint/empty_interpolation.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/lint/empty_interpolation.rb