Sha256: a32343f1f4970534a91172fa24d7fe7d75195d5bd00dd9417560f115592d3754
Contents?: true
Size: 903 Bytes
Versions: 1
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\.9/ ? -1 : 0) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
excellent-1.7.0 | lib/simplabs/excellent/checks/rails/instance_var_in_partial_check.rb |