Sha256: 5b8fee3c242501f0059542c5a356175f1be050ee05a9d960bdb0b648c597c22a

Contents?: true

Size: 611 Bytes

Versions: 9

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # This cop checks for the presence of empty expressions.
      #
      # @example
      #
      #   @bad
      #   foo = ()
      #   if ()
      #     bar
      #   end
      class EmptyExpression < Cop
        MSG = 'Avoid empty expressions.'.freeze

        def on_begin(node)
          return unless empty_expression?(node)

          add_offense(node, node.source_range, MSG)
        end

        private

        def empty_expression?(begin_node)
          begin_node.children.empty?
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/rubocop-0.46.0/lib/rubocop/cop/lint/empty_expression.rb
rubocop-0.46.0 lib/rubocop/cop/lint/empty_expression.rb
rubocop-0.45.0 lib/rubocop/cop/lint/empty_expression.rb