提交 277106c3 编写于 作者: J Justin Collins

User actual class name when rending collections

上级 da420b6e
......@@ -109,7 +109,9 @@ module Brakeman::RenderHelper
end
end
template_env[Sexp.new(:call, nil, variable, Sexp.new(:arglist))] = Sexp.new(:call, Sexp.new(:const, Brakeman::Tracker::UNKNOWN_MODEL), :new, Sexp.new(:arglist))
collection = get_class_target(options[:collection]) || Brakeman::Tracker::UNKNOWN_MODEL
template_env[Sexp.new(:call, nil, variable, Sexp.new(:arglist))] = Sexp.new(:call, Sexp.new(:const, collection), :new, Sexp.new(:arglist))
end
#Set original_line for values so it is clear
......@@ -154,4 +156,16 @@ module Brakeman::RenderHelper
options
end
def get_class_target sexp
if call? sexp
get_class_target sexp.target
else
begin
class_name sexp
rescue
nil
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册