Sha256: 126e9a3dc55b75262c7d5bc579adc28692b5f0207063d37667c84f11599540d2
Contents?: true
Size: 1.04 KB
Versions: 19
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require "rubocop" require "primer/deprecations" # :nocov: module RuboCop module Cop module Primer # This cop ensures that components don't use deprecated component names # # bad # Primer::ComponentNameComponent.new() # # good # Primer::Beta::ComponentName.new() class ComponentNameMigration < BaseCop def on_send(node) return unless node.method_name == :new && !node.receiver.nil? && ::Primer::Deprecations.deprecated?(node.receiver.const_name) add_offense(node.receiver, message: "Don't use deprecated names") end def autocorrect(node) lambda do |corrector| component_name = node.const_name return unless ::Primer::Deprecations.correctable?(component_name) suggested_component = ::Primer::Deprecations.suggested_component(component_name) corrector.replace(node, suggested_component) if suggested_component.present? end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems