Class: RuboCop::Cop::HmvcRails::OperatingStyle
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::HmvcRails::OperatingStyle
- Defined in:
- lib/rubocop/cop/hmvc_rails/operating_style.rb
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/rubocop/cop/hmvc_rails/operating_style.rb', line 7 def on_class(node) class_name = node.children.first.children.last.to_s return if class_name.end_with?("Operation") add_offense(node, message: "The operation name does not match the desired format") end |
#on_def(node) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rubocop/cop/hmvc_rails/operating_style.rb', line 14 def on_def(node) return unless node.children.first == :call node.body.to_a.compact.each do |ast| next if special_node?(ast.class) next if ast.is_a?(Symbol) && valid?(ast.to_s) next if ast.is_a?(RuboCop::AST::SendNode) && valid?(ast.children.last.to_s) add_offense(node, message: "Method works in \"call\" without prefix \"step_\"") end end |