Sha256: 4a34efb2c10df6f9aec999de2f9de911130b436db0c6463930cead3bc424ad24
Contents?: true
Size: 937 Bytes
Versions: 1
Compression:
Stored size: 937 Bytes
Contents
# encoding: utf-8 module Pelusa module Lint class EvalUsage def initialize @violations = Set.new end def check(klass) iterate_lines!(klass) if @violations.empty? SuccessfulAnalysis.new(name) else FailedAnalysis.new(name, @violations) do |violations| "There are #{violations.length} eval statement in lines #{violations.to_a.join(', ')}" end end end private def name "Doesn't use eval statement" end def iterate_lines!(klass) ClassAnalyzer.walk(klass) do |node| @violations << node.line if eval_violation?(node) end end def eval_violation?(node) node.is_a?(Rubinius::ToolSets::Runtime::ToolSet::AST::SendWithArguments) && node.name == :eval && node.receiver.is_a?(Rubinius::ToolSets::Runtime::ToolSet::AST::Self) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pelusa-0.2.4 | lib/pelusa/lint/eval_usage.rb |