class RuboCop::Cop::Ezcater::FeatureFlagActive

Use `EzcaterFeatureFlag.active?` with a tracking_id or array of identifiers

@example

# good
EzFF.active?("FlagName", tracking_id: "user:12345")
EzFF.active?("FlagName", identifiers: ["user:12345", "user:23456"])
EzFF.active?(defined_flag_name_var, tracking_id: "brand:12345")
EzFF.active?(@flag_name_ivar, tracking_id: "brand:12345")

# bad
EzFF.active?("FlagName")
EzFF.active?(defined_flag_name_var)
EzFF.active?(@flag_name_ivar)

Constants

FIRST_PARAM_MSG
MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/ezcater/feature_flag_active.rb, line 51
def on_send(node)
  return unless method_call_matcher(node)

  if !first_param_good(node)
    add_offense(node, location: :expression, message: FIRST_PARAM_MSG)
  end

  if ezff_active_one_arg(node) || !args_matcher(node)
    add_offense(node, location: :expression, message: MSG)
  end
end