Class: RuboCop::Cop::Sorbet::TypeAliasName
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sorbet::TypeAliasName
- Defined in:
- lib/rubocop/cop/sorbet/type_alias_name.rb
Overview
Ensures all constants used as ‘T.type_alias` are using CamelCase.
Constant Summary collapse
- MSG =
"Type alias constant name should be in CamelCase"
Instance Method Summary collapse
Instance Method Details
#on_casgn(node) ⇒ Object
32 33 34 |
# File 'lib/rubocop/cop/sorbet/type_alias_name.rb', line 32 def on_casgn(node) add_offense(node) if underscored_type_alias?(node) end |
#underscored_type_alias?(node) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubocop/cop/sorbet/type_alias_name.rb', line 21 def_node_matcher(:underscored_type_alias?, <<-PATTERN) (casgn _ /_/ # Name matches underscore (block (send (const nil? :T) :type_alias) ... ) ) PATTERN |