Sha256: b473e78b970ca54cd8d24ac289a139c1e48a9142afe9d19198b6834f216a60f1

Contents?: true

Size: 499 Bytes

Versions: 4

Compression:

Stored size: 499 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for uses if the keyword *not* instead of !.
      class Not < Cop
        MSG = 'Use ! instead of not.'

        def on_send(node)
          _receiver, method_name, *args = *node

          # not does not take any arguments
          if args.empty? && method_name == :! &&
              node.loc.selector.is?('not')
            add_offence(node, :selector)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.18.1 lib/rubocop/cop/style/not.rb
rubocop-0.18.0 lib/rubocop/cop/style/not.rb
rubocop-0.17.0 lib/rubocop/cop/style/not.rb
rubocop-0.16.0 lib/rubocop/cop/style/not.rb