Files

RailsBestPractices::Checks::MoveCodeIntoModelCheck

Check a view file to make sure there is no complex logic call for model.

Implementation: Check if a local variable or instance variable called more than 3 times in if conditional statement, then it should more code into model.

Public Instance Methods

evaluate_start(node) click to toggle source
# File lib/rails_best_practices/checks/move_code_into_model_check.rb, line 18
def evaluate_start(node)
  @variables = {}
  node.conditional_statement.grep_nodes(:node_type => :call).each { |call_node| remember_call(call_node) }
  check_errors
end
interesting_files() click to toggle source
# File lib/rails_best_practices/checks/move_code_into_model_check.rb, line 14
def interesting_files
  VIEW_FILES
end
interesting_nodes() click to toggle source
# File lib/rails_best_practices/checks/move_code_into_model_check.rb, line 10
def interesting_nodes
  [:if]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.