Sha256: b911febcb5fc552d1a58bc19ca67a53549936ef61d0abdd31880b16c71ca4c23

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

# ref. https://github.com/thoughtbot/hound/blob/d2f3933/app/models/pull_request.rb
class RuboCop::Git::PseudoPullRequest
  HOUND_CONFIG_FILE = '.hound.yml'.freeze

  def initialize(files, options)
    @files = files
    @options = options
  end

  def pull_request_files
    @files.map do |file|
      build_commit_file(file)
    end
  end

  def config
    return unless @options.hound

    File.read(HOUND_CONFIG_FILE)
  rescue Errno::ENOENT
    nil
  end

  private

  def build_commit_file(file)
    RuboCop::Git::CommitFile.new(file, head_commit)
  end

  def head_commit
    @head_commit ||= RuboCop::Git::Commit.new(@options)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-git2-0.1.6 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git2-0.1.5 lib/rubocop/git/pseudo_pull_request.rb