Skip to content

Commit

Permalink
Merge pull request #375 from arkadyan/master
Browse files Browse the repository at this point in the history
Changed all instances of the load_dependency method
  • Loading branch information
presidentbeef committed Jul 26, 2013
2 parents d921069 + e8fbca2 commit 37f9efb
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions lib/brakeman.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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|
Expand Down Expand Up @@ -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|
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion lib/brakeman/report/ignore/interactive.rb
@@ -1,4 +1,4 @@
Brakeman.load_dependency 'highline'
Brakeman.load_brakeman_dependency 'highline'

module Brakeman
class InteractiveIgnorer
Expand Down
2 changes: 1 addition & 1 deletion 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"

Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
6 changes: 3 additions & 3 deletions lib/brakeman/scanner.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/brakeman/util.rb
Expand Up @@ -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
Expand All @@ -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})
Expand Down

0 comments on commit 37f9efb

Please sign in to comment.