Class: RuboCop::Cop::Mable::UsingDeprecatedFFClient

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/mable/using_deprecated_ff_client.rb

Overview

We are in the process of transitioning out the old FeatureFlags::Client and want people to be using FeatureFlags::Repo

Examples:


# bad
FeatureFlags::Client.get_feature_flag("test", uuid: user.id)

# good
FeatureFlags::Repo.get_feature_flag("test", uuid: user.id)

Constant Summary collapse

MSG =
'FeatureFlags::Client is deprecated, please use FeatureFlags::Repo'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/rubocop/cop/mable/using_deprecated_ff_client.rb', line 26

def on_send(node)
  expression = deprecated_ff_client?(node)
  return unless expression

  add_offense(node) do |corrector|
    replacement = node.source.sub('FeatureFlags::Client', 'FeatureFlags::Repo')
    corrector.replace(node, replacement)
  end
end