Sha256: 092d400ba3f6d9a79f248a4f0b1d26065feaea244881fe928ca72749964db506
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
require 'simplabs/excellent/checks/base' module Simplabs module Excellent module Checks module Rails # This check reports partials that use instance variables. Using instance variables in partials couples the partial to the controller action or # template that includes the partial and that has to define the instance variable. # # ==== Applies to # # * partials class InstanceVarInPartialCheck < Base def initialize #:nodoc: super @interesting_contexts = [Parsing::IvarContext] @interesting_files = [/^_.*\.erb$/] end def evaluate(context) #:nodoc: add_warning(context, 'Instance variable {{variable}} used in partial.', { :variable => context.full_name }, RUBY_VERSION =~ /1\.8/ ? 0 : -1) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
excellent-1.7.2 | lib/simplabs/excellent/checks/rails/instance_var_in_partial_check.rb |
excellent-1.7.1 | lib/simplabs/excellent/checks/rails/instance_var_in_partial_check.rb |