Sha256: 7358182353564278c130b9445b47c36e1c8f6fb297f95031aecb1e2905f67d5b

Contents?: true

Size: 519 Bytes

Versions: 4

Compression:

Stored size: 519 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(:convention, node.loc.selector, MSG)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/style/not.rb
rubocop-0.11.1 lib/rubocop/cop/style/not.rb
rubocop-0.11.0 lib/rubocop/cop/style/not.rb
rubocop-0.10.0 lib/rubocop/cop/style/not.rb