Sha256: 3726d283d5cf3deae49fcca162c928384b9ddd127dc718268a4dbd87d26865d8
Contents?: true
Size: 881 Bytes
Versions: 1
Compression:
Stored size: 881 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::AST::SendWithArguments) && node.name == :eval && node.receiver.is_a?(Rubinius::AST::Self) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pelusa-0.2.3 | lib/pelusa/lint/eval_usage.rb |