提交 7aa0327d 编写于 作者: N Nick

Add option to exit with 1 if warnings are found

上级 a4bbfde7
......@@ -147,6 +147,10 @@ OptionParser.new do |opts|
end
end
opts.on( "-s", "--exit-on-warn", "Exit code is non-zero if warnings found.") do |s|
options[:exit_on_warn] = s
end
opts.separator ""
opts.on "-k", "--checks", "List all available vulnerability checks" do
......@@ -164,4 +168,9 @@ OptionParser.new do |opts|
end
end.parse!(ARGV)
Brakeman.run options
clean = Brakeman.run options
if options[:exit_on_warn] && !clean
exit 1
end
......@@ -184,5 +184,14 @@ module Brakeman
else
puts tracker.report.send(options[:output_format])
end
if options[:exit_on_warn]
tracker.checks.warnings.each do |warning|
next if warning.confidence > options[:min_confidence]
return false
end
end
return true
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册