Class: Moku6::Rules::ActionNamingRule

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/moku6/rules/action_naming_rule.rb

Instance Method Summary collapse

Methods inherited from BaseRule

#initialize

Constructor Details

This class inherits a constructor from Moku6::Rules::BaseRule

Instance Method Details

#check(event) ⇒ Object

: (Event event) -> Array



8
9
10
11
12
13
14
15
# File 'lib/moku6/rules/action_naming_rule.rb', line 8

def check(event)
  pattern = Regexp.new(@config.naming_pattern.to_s)
  return [] if event.action.to_s.match?(pattern)

  [offense(event, :error,
    "action '#{event.action}' violates the naming convention " \
    "(expected: namespace.verb form, lowercase, dot-separated).")]
end