Sha256: 7d56a5f24000d311f4dfbca9ab9c89fad28173308a304ec0fa431faf4ef0ea2f
Contents?: true
Size: 802 Bytes
Versions: 2
Compression:
Stored size: 802 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Rails # This cop checks that Active Support's `inquiry` method is not used. # # @example # # bad - String#inquiry # ruby = 'two'.inquiry # ruby.two? # # # good # ruby = 'two' # ruby == 'two' # # # bad - Array#inquiry # pets = %w(cat dog).inquiry # pets.gopher? # # # good # pets = %w(cat dog) # pets.include? 'cat' # class Inquiry < Cop MSG = "Prefer Ruby's comparison operators over Active Support's `inquiry`." def on_send(node) add_offense(node, location: :selector) if node.method?(:inquiry) && node.arguments.empty? end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rails-2.7.1 | lib/rubocop/cop/rails/inquiry.rb |
rubocop-rails-2.7.0 | lib/rubocop/cop/rails/inquiry.rb |