Sha256: ebf57d2ec9bb406e6f99430928f41d2ecc8e0a79114819c6d2d28674ec24eecf

Contents?: true

Size: 536 Bytes

Versions: 3

Compression:

Stored size: 536 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

          super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 lib/rubocop/cop/style/not.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/style/not.rb
rubocop-0.9.0 lib/rubocop/cop/style/not.rb