Class: RuboCop::Cop::Airbnb::PhraseBundleKeys
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Airbnb::PhraseBundleKeys
- Defined in:
- lib/rubocop/cop/airbnb/phrase_bundle_keys.rb
Overview
Prefer matching Phrase Bundle and t call keys inside of PhraseBundleClasses.
Constant Summary collapse
- MESSAGE =
'Phrase bundle keys should match their translation keys.'.freeze
- RESTRICT_ON_SEND =
%i(t).freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/airbnb/phrase_bundle_keys.rb', line 32 def on_send(node) parent = node.parent if in_phrase_bundle_class?(node) && parent.pair_type? hash_key = parent.children[0] unless hash_key.children[0] == node.children[2].children[0] add_offense(hash_key, message: MESSAGE) end end end |