提交 37f9efb9 编写于 作者: J Justin

Merge pull request #375 from arkadyan/master

Changed all instances of the load_dependency method
...@@ -153,7 +153,7 @@ module Brakeman ...@@ -153,7 +153,7 @@ module Brakeman
end end
end end
end end
def self.get_formats_from_output_format output_format def self.get_formats_from_output_format output_format
case output_format case output_format
when :html, :to_html when :html, :to_html
...@@ -171,7 +171,7 @@ module Brakeman ...@@ -171,7 +171,7 @@ module Brakeman
end end
end end
private_class_method :get_formats_from_output_format private_class_method :get_formats_from_output_format
def self.get_formats_from_output_files output_files def self.get_formats_from_output_files output_files
output_files.map do |output_file| output_files.map do |output_file|
case output_file case output_file
...@@ -196,7 +196,7 @@ module Brakeman ...@@ -196,7 +196,7 @@ module Brakeman
def self.list_checks def self.list_checks
require 'brakeman/scanner' require 'brakeman/scanner'
format_length = 30 format_length = 30
$stderr.puts "Available Checks:" $stderr.puts "Available Checks:"
$stderr.puts "-" * format_length $stderr.puts "-" * format_length
Checks.checks.each do |check| Checks.checks.each do |check|
...@@ -307,7 +307,7 @@ module Brakeman ...@@ -307,7 +307,7 @@ module Brakeman
tracker tracker
end end
def self.write_report_to_files tracker, output_files def self.write_report_to_files tracker, output_files
output_files.each_with_index do |output_file, idx| output_files.each_with_index do |output_file, idx|
File.open output_file, "w" do |f| File.open output_file, "w" do |f|
...@@ -317,7 +317,7 @@ module Brakeman ...@@ -317,7 +317,7 @@ module Brakeman
end end
end end
private_class_method :write_report_to_files private_class_method :write_report_to_files
def self.write_report_to_formats tracker, output_formats def self.write_report_to_formats tracker, output_formats
output_formats.each do |output_format| output_formats.each do |output_format|
puts tracker.report.format(output_format) puts tracker.report.format(output_format)
...@@ -375,7 +375,7 @@ module Brakeman ...@@ -375,7 +375,7 @@ module Brakeman
Brakeman::Differ.new(new_results, previous_results).diff Brakeman::Differ.new(new_results, previous_results).diff
end end
def self.load_dependency name def self.load_brakeman_dependency name
return if @loaded_dependencies.include? name return if @loaded_dependencies.include? name
begin begin
......
Brakeman.load_dependency 'erubis' Brakeman.load_brakeman_dependency 'erubis'
#Erubis processor which ignores any output which is plain text. #Erubis processor which ignores any output which is plain text.
class Brakeman::ScannerErubis < Erubis::Eruby class Brakeman::ScannerErubis < Erubis::Eruby
......
Brakeman.load_dependency 'erubis' Brakeman.load_brakeman_dependency 'erubis'
#This is from the rails_xss plugin for Rails 2 #This is from the rails_xss plugin for Rails 2
class Brakeman::Rails2XSSPluginErubis < ::Erubis::Eruby class Brakeman::Rails2XSSPluginErubis < ::Erubis::Eruby
......
Brakeman.load_dependency 'erubis' Brakeman.load_brakeman_dependency 'erubis'
#This is from Rails 3 version of the Erubis handler #This is from Rails 3 version of the Erubis handler
class Brakeman::Rails3Erubis < ::Erubis::Eruby class Brakeman::Rails3Erubis < ::Erubis::Eruby
......
Brakeman.load_dependency 'highline' Brakeman.load_brakeman_dependency 'highline'
module Brakeman module Brakeman
class InteractiveIgnorer class InteractiveIgnorer
......
Brakeman.load_dependency 'csv' Brakeman.load_brakeman_dependency 'csv'
require "brakeman/report/initializers/faster_csv" require "brakeman/report/initializers/faster_csv"
require "brakeman/report/report_table" require "brakeman/report/report_table"
......
Brakeman.load_dependency 'multi_json' Brakeman.load_brakeman_dependency 'multi_json'
require 'brakeman/report/initializers/multi_json' require 'brakeman/report/initializers/multi_json'
class Brakeman::Report::JSON < Brakeman::Report::Base class Brakeman::Report::JSON < Brakeman::Report::Base
......
Brakeman.load_dependency 'terminal-table' Brakeman.load_brakeman_dependency 'terminal-table'
class Brakeman::Report::Table < Brakeman::Report::Base class Brakeman::Report::Table < Brakeman::Report::Base
def generate_report def generate_report
......
...@@ -282,14 +282,14 @@ class Brakeman::Scanner ...@@ -282,14 +282,14 @@ class Brakeman::Scanner
parsed = parse_ruby src parsed = parse_ruby src
elsif type == :haml elsif type == :haml
Brakeman.load_dependency 'haml' Brakeman.load_brakeman_dependency 'haml'
Brakeman.load_dependency 'sass' Brakeman.load_brakeman_dependency 'sass'
src = Haml::Engine.new(text, src = Haml::Engine.new(text,
:escape_html => !!tracker.config[:escape_html]).precompiled :escape_html => !!tracker.config[:escape_html]).precompiled
parsed = parse_ruby src parsed = parse_ruby src
elsif type == :slim elsif type == :slim
Brakeman.load_dependency 'slim' Brakeman.load_brakeman_dependency 'slim'
src = Slim::Template.new(:disable_capture => true, src = Slim::Template.new(:disable_capture => true,
:generator => Temple::Generators::RailsOutputBuffer) { text }.precompiled_template :generator => Temple::Generators::RailsOutputBuffer) { text }.precompiled_template
......
...@@ -385,7 +385,7 @@ module Brakeman::Util ...@@ -385,7 +385,7 @@ module Brakeman::Util
def truncate_table str def truncate_table str
@terminal_width ||= if $stdin && $stdin.tty? @terminal_width ||= if $stdin && $stdin.tty?
Brakeman.load_dependency 'highline' Brakeman.load_brakeman_dependency 'highline'
::HighLine.new.terminal_size[0] ::HighLine.new.terminal_size[0]
else else
80 80
...@@ -403,7 +403,7 @@ module Brakeman::Util ...@@ -403,7 +403,7 @@ module Brakeman::Util
# rely on Terminal::Table to build the structure, extract the data out in CSV format # rely on Terminal::Table to build the structure, extract the data out in CSV format
def table_to_csv table def table_to_csv table
Brakeman.load_dependency 'terminal-table' Brakeman.load_brakeman_dependency 'terminal-table'
output = CSV.generate_line(table.headings.cells.map{|cell| cell.to_s.strip}) output = CSV.generate_line(table.headings.cells.map{|cell| cell.to_s.strip})
table.rows.each do |row| table.rows.each do |row|
output << CSV.generate_line(row.cells.map{|cell| cell.to_s.strip}) output << CSV.generate_line(row.cells.map{|cell| cell.to_s.strip})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册