Sha256: 10dcb6d201023d7156467c2e1fe22f4b9e0c7ef22c0e64a7988fedcc8f7f94ab
Contents?: true
Size: 726 Bytes
Versions: 15
Compression:
Stored size: 726 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # This cop checks for empty interpolation. # # @example # # # bad # # "result is #{}" # # @example # # # good # # "result is #{some_result}" class EmptyInterpolation < Cop MSG = 'Empty interpolation detected.' def on_dstr(node) node.each_child_node(:begin) do |begin_node| add_offense(begin_node) if begin_node.children.empty? end end def autocorrect(node) lambda do |collector| collector.remove(node.loc.expression) end end end end end end
Version data entries
15 entries across 15 versions & 2 rubygems