class Fudge::Tasks::Brakeman

Allow use of Brakeman securty scanner

task :brakeman

runs brakeman with max score of 0

task :brakeman, :max => 2

sets max score to 2

Any and all options can be defined

task :brakeman

Private Instance Methods

brakeman_checker(matches) click to toggle source
# File lib/fudge/tasks/brakeman.rb, line 33
def brakeman_checker(matches)
  score = matches[:score].to_i
  if score > max_score
    "Brakeman reported more than #{max_score} issues."
  else
    true
  end
end
check_for() click to toggle source
# File lib/fudge/tasks/brakeman.rb, line 25
def check_for
  [check_regex, method(:brakeman_checker)]
end
check_regex() click to toggle source
# File lib/fudge/tasks/brakeman.rb, line 29
def check_regex
  /\|?\s?Security Warnings\:?\s?\|?\s?(?<score>\d+)/
end
cmd(options={}) click to toggle source
# File lib/fudge/tasks/brakeman.rb, line 20
def cmd(options={})
  bundle_cmd("brakeman #{arguments}", options)
end
max_score() click to toggle source
# File lib/fudge/tasks/brakeman.rb, line 42
def max_score
  options.fetch(:max, 0)
end