Class: RuboCop::Cop::Obsession::Graphql::MutationName
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Obsession::Graphql::MutationName
- Includes:
- Helpers
- Defined in:
- lib/rubocop/cop/obsession/graphql/mutation_name.rb
Overview
This cop checks for mutation names that do not start with a verb.
Mutation names should start with a verb, because mutations are actions, and actions are best described with verbs.
Constant Summary collapse
- MSG =
'Mutation name should start with a verb.'
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#on_class(class_node) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/rubocop/cop/obsession/graphql/mutation_name.rb', line 30 def on_class(class_node) class_name = class_node.identifier.source class_name_first_word = class_name.underscore.split('_').first add_offense(class_node) if !verb?(class_name_first_word) end |