Sha256: de6b98660da760e6717d52b1622613266aa3697b5279b16418497ea2dfa100f0

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 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 && PRINTABLE_REGEXP.match(line)
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warder-0.2.1 lib/warder/rails_security_runner.rb
warder-0.2.0 lib/warder/rails_security_runner.rb