class Danger::DangerBrakemanScanner
Run ruby files through Brakeman
@example Run with default configuration in application directory
brakeman_scanner.run
@see github.com/presidentbeef/brakeman @tags brakeman, security, ruby
Public Instance Methods
run(options = File.dirname(Kernel.caller_locations.first.absolute_path))
click to toggle source
Run a Brakeman scan over current application.
@param options (see {Brakeman.run}) @return [void]
# File lib/danger_plugin.rb, line 18 def run(options = File.dirname(Kernel.caller_locations.first.absolute_path)) tracker = Brakeman.run(options) warnings = if tracker.ignored_filter tracker.warnings.reject do |warning| tracker.ignored_filter.ignored_warnings.include?(warning) end else tracker.warnings end return if warnings.empty? && tracker.errors.empty? markdown tracker.report.to_markdown failure "Brakeman static analysis detected issues in the code. " \ "If this is a false positive, [mark it as such]" \ "(https://brakemanscanner.org/docs/ignoring_false_positives/)." end