Running Brakeman via Rake is discouraged because it loads the entire Rails application. This is unnecessary and can cause strange behavior.
Here is a simple Rake task to run Brakeman. It can be added to your
Rakefile or in the
namespace :brakeman do desc "Run Brakeman" task :run, :output_files do |t, args| require 'brakeman' files = args[:output_files].split(' ') if args[:output_files] Brakeman.run :app_path => ".", :output_files => files, :print_report => true end end
This task will run Brakeman with no options. If given an output file, it will save the report in that file. Otherwise, it will print the report out to the console.
To use this task:
This task can easily be customized. See Brakeman as a Library for more information.