Class: RuboCop::Cop::Captive::Translation::DeviseI18nPresence

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/captive/translation/devise_i18n_presence.rb

Constant Summary collapse

MSG =
"The gem `devise-i18n` should be added to the Gemfile "\
"if `devise` is present in Gemfile"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/captive/translation/devise_i18n_presence.rb', line 11

def on_send(node)
  return unless node.command?(:gem)

  gem_name = node.arguments[0]&.value
  return unless gem_name == 'devise'

  add_offense(node, message: MSG) unless devise_i18n_present?
end