Sha256: 01d84cf7cacf285f9e2371265c92095295525cd43648c11b7a13e5f03a59c86f

Contents?: true

Size: 633 Bytes

Versions: 12

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

module Overcommit::Hook::PreCommit
  # Checks for vulnerable versions of gems in Gemfile.lock.
  #
  # @see https://github.com/rubysec/bundler-audit
  class BundleAudit < Base
    LOCK_FILE = 'Gemfile.lock'

    def run
      # Ignore if Gemfile.lock is not tracked by git
      ignored_files = execute(%W[git ls-files -o -i --exclude-standard -- #{LOCK_FILE}]).
                      stdout.split("\n")
      return :pass if ignored_files.include?(LOCK_FILE)

      result = execute(command)
      if result.success?
        :pass
      else
        [:warn, result.stdout]
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
overcommit-0.67.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.66.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.65.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.64.1 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.64.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.63.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.62.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.61.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.60.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.59.1 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.59.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-jeygeethanmedia-0.58.0 lib/overcommit/hook/pre_commit/bundle_audit.rb