Class: RubocopPr::CLI::ProcessCop

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_pr/cli/process_cop.rb

Overview

Cop processor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git:, repository:, cop:, options:) ⇒ ProcessCop

Returns a new instance of ProcessCop.



7
8
9
10
11
12
# File 'lib/rubocop_pr/cli/process_cop.rb', line 7

def initialize(git:, repository:, cop:, options:)
  @git = git
  @repository = repository
  @cop = cop
  @options = options
end

Instance Attribute Details

#copObject (readonly)

Returns the value of attribute cop.



5
6
7
# File 'lib/rubocop_pr/cli/process_cop.rb', line 5

def cop
  @cop
end

#gitObject (readonly)

Returns the value of attribute git.



5
6
7
# File 'lib/rubocop_pr/cli/process_cop.rb', line 5

def git
  @git
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/rubocop_pr/cli/process_cop.rb', line 5

def options
  @options
end

#repositoryObject (readonly)

Returns the value of attribute repository.



5
6
7
# File 'lib/rubocop_pr/cli/process_cop.rb', line 5

def repository
  @repository
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
# File 'lib/rubocop_pr/cli/process_cop.rb', line 14

def call
  return false if exit_early?
  checkout_to_target_branch_throw_master_branch
  git.commit_all(issue.title)
  git.push
  create_pr
end