提交 c025ae5b 编写于 作者: J Justin Collins

Code cleanup on Rescanner#to_s(true)

上级 ec4a2dbf
......@@ -256,30 +256,34 @@ class Brakeman::RescanReport
#Output total, fixed, and new warnings
def to_s(verbose = false)
if !verbose
<<-OUTPUT
<<-OUTPUT
Total warnings: #{all_warnings.length}
Fixed warnings: #{fixed_warnings.length}
New warnings: #{new_warnings.length}
OUTPUT
OUTPUT
else
existing_warnings = all_warnings - new_warnings
"".tap do |out|
{:fixed => fixed_warnings, :new => new_warnings, :existing => existing_warnings}.each do |warning_type, warnings|
if warnings.length > 0
out << "#{warning_type.to_s.titleize} warnings: #{warnings.length}\n"
table = Ruport::Data::Table(["Confidence", "Class", "Method", "Warning Type", "Message"])
warnings.sort_by{|w| w.confidence}.each do |warning|
w = warning.to_row
w["Confidence"] = Brakeman::Report::TEXT_CONFIDENCE[w["Confidence"]] if w["Confidence"].is_a?(Numeric)
table << warning.to_row
end
out << table.to_s
#Eventually move this to different method, or make default to_s
out = ""
{:fixed => fixed_warnings, :new => new_warnings, :existing => existing_warnings}.each do |warning_type, warnings|
if warnings.length > 0
out << "#{warning_type.to_s.titleize} warnings: #{warnings.length}\n"
table = Ruport::Data::Table(["Confidence", "Class", "Method", "Warning Type", "Message"])
warnings.sort_by { |w| w.confidence}.each do |warning|
w = warning.to_row
w["Confidence"] = Brakeman::Report::TEXT_CONFIDENCE[w["Confidence"]]
table << w
end
out << table.to_s
end
end
out
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册