From e8fbca25d9b84e0aa2748b433320a0b18439f723 Mon Sep 17 00:00:00 2001 From: Matthew Shanley Date: Fri, 26 Jul 2013 11:41:26 -0400 Subject: [PATCH] Changed all instances of the load_dependency method to load_brakeman_dependency. Fixes #373 --- lib/brakeman.rb | 12 ++++++------ lib/brakeman/parsers/rails2_erubis.rb | 2 +- lib/brakeman/parsers/rails2_xss_plugin_erubis.rb | 2 +- lib/brakeman/parsers/rails3_erubis.rb | 2 +- lib/brakeman/report/ignore/interactive.rb | 2 +- lib/brakeman/report/report_csv.rb | 2 +- lib/brakeman/report/report_json.rb | 2 +- lib/brakeman/report/report_table.rb | 2 +- lib/brakeman/scanner.rb | 6 +++--- lib/brakeman/util.rb | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/brakeman.rb b/lib/brakeman.rb index 752a2f8275..2262d6a824 100644 --- a/lib/brakeman.rb +++ b/lib/brakeman.rb @@ -153,7 +153,7 @@ def self.get_output_formats options end end end - + def self.get_formats_from_output_format output_format case output_format when :html, :to_html @@ -171,7 +171,7 @@ def self.get_formats_from_output_format output_format end end private_class_method :get_formats_from_output_format - + def self.get_formats_from_output_files output_files output_files.map do |output_file| case output_file @@ -196,7 +196,7 @@ def self.get_formats_from_output_files output_files def self.list_checks require 'brakeman/scanner' format_length = 30 - + $stderr.puts "Available Checks:" $stderr.puts "-" * format_length Checks.checks.each do |check| @@ -307,7 +307,7 @@ def self.scan options tracker end - + def self.write_report_to_files tracker, output_files output_files.each_with_index do |output_file, idx| File.open output_file, "w" do |f| @@ -317,7 +317,7 @@ def self.write_report_to_files tracker, output_files end end private_class_method :write_report_to_files - + def self.write_report_to_formats tracker, output_formats output_formats.each do |output_format| puts tracker.report.format(output_format) @@ -375,7 +375,7 @@ def self.compare options Brakeman::Differ.new(new_results, previous_results).diff end - def self.load_dependency name + def self.load_brakeman_dependency name return if @loaded_dependencies.include? name begin diff --git a/lib/brakeman/parsers/rails2_erubis.rb b/lib/brakeman/parsers/rails2_erubis.rb index 9c33503b1c..199d4d5b1a 100644 --- a/lib/brakeman/parsers/rails2_erubis.rb +++ b/lib/brakeman/parsers/rails2_erubis.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'erubis' +Brakeman.load_brakeman_dependency 'erubis' #Erubis processor which ignores any output which is plain text. class Brakeman::ScannerErubis < Erubis::Eruby diff --git a/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb b/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb index f11b621694..7ea33978f0 100644 --- a/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +++ b/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'erubis' +Brakeman.load_brakeman_dependency 'erubis' #This is from the rails_xss plugin for Rails 2 class Brakeman::Rails2XSSPluginErubis < ::Erubis::Eruby diff --git a/lib/brakeman/parsers/rails3_erubis.rb b/lib/brakeman/parsers/rails3_erubis.rb index af5aafa380..e178af1dc8 100644 --- a/lib/brakeman/parsers/rails3_erubis.rb +++ b/lib/brakeman/parsers/rails3_erubis.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'erubis' +Brakeman.load_brakeman_dependency 'erubis' #This is from Rails 3 version of the Erubis handler class Brakeman::Rails3Erubis < ::Erubis::Eruby diff --git a/lib/brakeman/report/ignore/interactive.rb b/lib/brakeman/report/ignore/interactive.rb index cf3d60e798..fa17142d9e 100644 --- a/lib/brakeman/report/ignore/interactive.rb +++ b/lib/brakeman/report/ignore/interactive.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'highline' +Brakeman.load_brakeman_dependency 'highline' module Brakeman class InteractiveIgnorer diff --git a/lib/brakeman/report/report_csv.rb b/lib/brakeman/report/report_csv.rb index c69301f9c0..494ad2c3fe 100644 --- a/lib/brakeman/report/report_csv.rb +++ b/lib/brakeman/report/report_csv.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'csv' +Brakeman.load_brakeman_dependency 'csv' require "brakeman/report/initializers/faster_csv" require "brakeman/report/report_table" diff --git a/lib/brakeman/report/report_json.rb b/lib/brakeman/report/report_json.rb index 5a095effc7..96f6a80eeb 100644 --- a/lib/brakeman/report/report_json.rb +++ b/lib/brakeman/report/report_json.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'multi_json' +Brakeman.load_brakeman_dependency 'multi_json' require 'brakeman/report/initializers/multi_json' class Brakeman::Report::JSON < Brakeman::Report::Base diff --git a/lib/brakeman/report/report_table.rb b/lib/brakeman/report/report_table.rb index 7384693923..5d5f419173 100644 --- a/lib/brakeman/report/report_table.rb +++ b/lib/brakeman/report/report_table.rb @@ -1,4 +1,4 @@ -Brakeman.load_dependency 'terminal-table' +Brakeman.load_brakeman_dependency 'terminal-table' class Brakeman::Report::Table < Brakeman::Report::Base def generate_report diff --git a/lib/brakeman/scanner.rb b/lib/brakeman/scanner.rb index 41b241e8be..e4ac31d673 100644 --- a/lib/brakeman/scanner.rb +++ b/lib/brakeman/scanner.rb @@ -282,14 +282,14 @@ def process_template path parsed = parse_ruby src elsif type == :haml - Brakeman.load_dependency 'haml' - Brakeman.load_dependency 'sass' + Brakeman.load_brakeman_dependency 'haml' + Brakeman.load_brakeman_dependency 'sass' src = Haml::Engine.new(text, :escape_html => !!tracker.config[:escape_html]).precompiled parsed = parse_ruby src elsif type == :slim - Brakeman.load_dependency 'slim' + Brakeman.load_brakeman_dependency 'slim' src = Slim::Template.new(:disable_capture => true, :generator => Temple::Generators::RailsOutputBuffer) { text }.precompiled_template diff --git a/lib/brakeman/util.rb b/lib/brakeman/util.rb index 9c3d7c65c0..ffc167eb92 100644 --- a/lib/brakeman/util.rb +++ b/lib/brakeman/util.rb @@ -385,7 +385,7 @@ def relative_path file def truncate_table str @terminal_width ||= if $stdin && $stdin.tty? - Brakeman.load_dependency 'highline' + Brakeman.load_brakeman_dependency 'highline' ::HighLine.new.terminal_size[0] else 80 @@ -403,7 +403,7 @@ def truncate_table str # rely on Terminal::Table to build the structure, extract the data out in CSV format 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}) table.rows.each do |row| output << CSV.generate_line(row.cells.map{|cell| cell.to_s.strip})