Sha256: c8cf916b2dfd379b6e404b32b599885a42f6a3b20ad27cad02eb72dcc3ac89a4

Contents?: true

Size: 577 Bytes

Versions: 8

Compression:

Stored size: 577 Bytes

Contents

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'.freeze

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
overcommit-0.41.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.40.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.39.1 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.39.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.38.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.37.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.36.0 lib/overcommit/hook/pre_commit/bundle_audit.rb
overcommit-0.35.0 lib/overcommit/hook/pre_commit/bundle_audit.rb