Sha256: b27b4ae5280791cc151a682e680aa98b3638704770c1465b53b411121a4e24b6

Contents?: true

Size: 420 Bytes

Versions: 4

Compression:

Stored size: 420 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    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.source == 'not'
          add_offence(:convention, node.loc.line, MSG)
        end

        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 lib/rubocop/cop/not.rb
rubocop-0.8.2 lib/rubocop/cop/not.rb
rubocop-0.8.1 lib/rubocop/cop/not.rb
rubocop-0.8.0 lib/rubocop/cop/not.rb