Sha256: 44ef9391f51912b9a8ccdad12be4086686343416dc5287fb4d7b0a5cf621bf01

Contents?: true

Size: 712 Bytes

Versions: 7

Compression:

Stored size: 712 Bytes

Contents

module Warder
  # responsible for run rails security validation
  class RailsSecurityRunner < Runner
    CLI_OPTION = 'i'
    CLI_FULL_OPTION = 'rails-security'
    DESCRIPTION = 'Run rails security validation'
    COMMAND_NAME = 'brakeman'
    FAILURE_REGEXP = /^\| (High|Medium|Weak)/
    PRINTABLE_REGEXP =
      /(\| Confidence)|(\| High)|(\| Medium)|(\| Weak)|(\+------------\+)/

    private

    def command_with_options
      path = @options.files.split(' ').first
      "#{COMMAND_NAME} -q -p #{path}"
    end

    def printable?(line)
      super && self.class::PRINTABLE_REGEXP.match(line)
    end

    def number_of_issues(line)
      self.class::FAILURE_REGEXP.match(line) ? 1 : 0
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
warder-0.3.4 lib/warder/rails_security_runner.rb
warder-0.3.2 lib/warder/rails_security_runner.rb
warder-0.3.1 lib/warder/rails_security_runner.rb
warder-0.3.0 lib/warder/rails_security_runner.rb
warder-0.2.4 lib/warder/rails_security_runner.rb
warder-0.2.3 lib/warder/rails_security_runner.rb
warder-0.2.2 lib/warder/rails_security_runner.rb