Sha256: 99b9ddd681f2ebb79088b740863046279924bf1f7dd761d62fe2b736c6b70c1c
Contents?: true
Size: 904 Bytes
Versions: 7
Compression:
Stored size: 904 Bytes
Contents
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module RuboCop module Cop module Security module Object # This cop checks for the use of `Object#is_a?`. # # @example # # # bad # Object.is_a? # # # good # Object.cs__is_a? class IsA < Cop MSG = 'The use of `Object#is_a?` is a compatibility risk.' def eligible_node? node node.method?(:is_a?) end def on_send node return false unless eligible_node?(node) add_offense(node, location: :selector) end def autocorrect node ->(corrector) { corrector.replace(node.loc.selector, 'cs__is_a?') } end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems