Sha256: 747a86c0c17d3eea1b6f4d2f52a9bda86deccb108e732e7492ec2c760a264b0a
Contents?: true
Size: 992 Bytes
Versions: 7
Compression:
Stored size: 992 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 Module # This cop checks for the use of `Module#name`. # # @example # # # bad # Module.name # # # good # Module.cs__name class Name < Cop MSG = 'The use of `Module#name` is a compatibility risk.' def eligible_node? node false && node.method?(:name) # TODO: replace ExclusionMatcher#name, Rule#name, & ModuleData#name before enabling 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__name') } end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems