Sha256: 380f87e59ea7ab75a40a65b6d6704597013a3700a3cc4027541d3dcb9a8567de
Contents?: true
Size: 618 Bytes
Versions: 2
Compression:
Stored size: 618 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for uses if the keyword *not* instead of !. class Not < Cop include AutocorrectUnlessChangingAST MSG = 'Use `!` instead of `not`.'.freeze def on_send(node) return unless node.keyword_not? add_offense(node, :selector) end private def correction(node) new_source = node.source.sub(/not\s+/, '!') ->(corrector) { corrector.replace(node.source_range, new_source) } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.37.0 | lib/rubocop/cop/style/not.rb |
rubocop-0.36.0 | lib/rubocop/cop/style/not.rb |