Sha256: 45acfdbb8c34834c710a6229768a41302b6d39b22575a78160916f89fda80b17
Contents?: true
Size: 797 Bytes
Versions: 14
Compression:
Stored size: 797 Bytes
Contents
require 'rails_best_practices/checks/check' module RailsBestPractices module Checks # Check a view file to make sure there is no complex options_for_select message call. # # Implementation: Check if arguments of options_for_select message call contain more than 2 method call, then move it into helper. class MoveCodeIntoHelperCheck < Check def interesting_nodes [:call] end def interesting_files VIEW_FILES end def evaluate_start(node) add_error "move code into helper" if complex_select_options?(node) end private def complex_select_options?(node) :options_for_select == node.message and node.arguments.grep_nodes(:node_type => :call).size > 2 end end end end
Version data entries
14 entries across 14 versions & 1 rubygems