Sha256: 1e76a2147e844abd9a09bccbacfa3efd1c47cee50e84005dd295d77d05ae02eb
Contents?: true
Size: 1.06 KB
Versions: 10
Compression:
Stored size: 1.06 KB
Contents
# encoding: utf-8 require 'rails_best_practices/reviews/review' module RailsBestPractices module Reviews # Review a partail view file to make sure there is no instance variable. # # See the best practice details here # http://rails-bestpractices.com/posts/27-replace-instance-variable-with-local-variable. # # Implementation: # # Review process: # check all instance variable in partial view files, # if exist, then they should be replaced with local variable class ReplaceInstanceVariableWithLocalVariableReview < Review interesting_nodes :var_ref, :vcall interesting_files PARTIAL_VIEW_FILES url "http://rails-bestpractices.com/posts/27-replace-instance-variable-with-local-variable" # check ivar node in partial view file, # it is an instance variable, and should be replaced with local variable. add_callback :start_var_ref, :start_vcall do |node| if node.to_s.start_with?('@') add_error "replace instance variable with local variable" end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems