Sha256: 9c48c1e4484479ecf8febf34d3e613569f2cc18d82b516fa81a527bf4283f4c6

Contents?: true

Size: 735 Bytes

Versions: 13

Compression:

Stored size: 735 Bytes

Contents

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

      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)
        CommitFile.new(file, head_commit)
      end

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

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
rubocop-git2-0.1.4 lib/rubocop/git/pseudo_pull_request.rb
cs-rubocop-git-0.1.4 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.1.3 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-kjanoudi-0.1.4 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-kjanoudi-0.1.3 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-kjanoudi-0.1.2 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.1.2 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.1.1 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.1.0 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.0.6 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.0.5 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.0.4 lib/rubocop/git/pseudo_pull_request.rb
rubocop-git-0.0.3 lib/rubocop/git/pseudo_pull_request.rb