Class: PolishGeeks::DevTools::Commands::Brakeman
- Defined in:
- lib/polish_geeks/dev_tools/commands/brakeman.rb
Overview
A static analysis security vulnerability scanner for Ruby on Rails applications
Constant Summary collapse
- REGEXPS =
Regexps to get some stat info from brakeman output
{ controllers: /Controller.* (\d+)/, models: /Model.* (\d+)/, templates: /Template.* (\d+)/, errors: /Error.* (\d+)/, warnings: /Warning.* (\d+)/ }.freeze
Constants inherited from Base
PolishGeeks::DevTools::Commands::Base::TYPES
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute ⇒ String
Executes this command.
-
#label ⇒ String
Label with details bout brakeman scan.
-
#valid? ⇒ Boolean
True if we didn’t have any vulnerabilities detected.
Methods inherited from Base
#ensure_executable!, #error_message
Instance Method Details
#execute ⇒ String
Executes this command
24 25 26 27 28 |
# File 'lib/polish_geeks/dev_tools/commands/brakeman.rb', line 24 def execute cmd = ['bundle exec brakeman -q'] cmd << "-c #{self.class.config_manager.path}" if self.class.config_manager.present? @output = Shell.new.execute(cmd.join(' ')) end |
#label ⇒ String
Returns label with details bout brakeman scan.
36 37 38 |
# File 'lib/polish_geeks/dev_tools/commands/brakeman.rb', line 36 def label "Brakeman (#{controllers} con, #{models} mod, #{templates} temp)" end |
#valid? ⇒ Boolean
Returns true if we didn’t have any vulnerabilities detected.
31 32 33 |
# File 'lib/polish_geeks/dev_tools/commands/brakeman.rb', line 31 def valid? warnings.zero? && errors.zero? end |