module Overcommit::Hook::PreCommit
  # Runs `brakeman` against any modified Ruby/Rails files.
  class Brakeman < Base
    def run
      unless in_path?('brakeman')
        return :warn, 'Run `gem install brakeman`'
      end

      result = execute(%w[brakeman --exit-on-warn --quiet --summary --only-files] + applicable_files)

      if result.success?
        :good
      else
        [ :bad, result.stdout ]
      end
    end
  end
end

module Overcommit::Hook::PreCommit
  # Runs `brakeman` against any modified Ruby/Rails files.
  class Brakeman < Base
    def run
      unless in_path?('brakeman')
        return :warn, 'Run `gem install brakeman`'
      end

      result = execute(%w[brakeman --exit-on-warn --quiet --summary --only-files] +
                       applicable_files)
      return :good if result.success?

      [:bad, result.stdout]
    end
  end
end

Clean up Brakeman pre-commit hook
Clean up Brakeman pre-commit hook

Change-Id: If8ca86338b4d85a0d761ade716c8697ad69178b8
Reviewed-on: http://gerrit.causes.com/37961
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
