Class: Danger::DangerBrakemanScanner
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerBrakemanScanner
- Defined in:
- lib/danger_plugin.rb
Overview
Run ruby files through Brakeman
Direct Known Subclasses
Instance Method Summary collapse
-
#run(options = File.dirname(Kernel.caller_locations.first.absolute_path)) ⇒ void
Run a Brakeman scan over current application.
Instance Method Details
#run(options = File.dirname(Kernel.caller_locations.first.absolute_path)) ⇒ void
This method returns an undefined value.
Run a Brakeman scan over current application.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/danger_plugin.rb', line 18 def run( = File.dirname(Kernel.caller_locations.first.absolute_path)) tracker = Brakeman.run() 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 |