rubocop_pr 1.0.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a991a0a8cb80ef2954672a3437172cd1a7bc84d4d3e95fc53cdff0a89c6c252
4
- data.tar.gz: c834cbddaec6aeb63dc8d1d60adfa36ac9c07c7a010bdfad112fb3652c5eb2e6
3
+ metadata.gz: 3d9556b71acd309753dbdb674136ffd61627cd8689fe32e295f937f800e452f0
4
+ data.tar.gz: a76c9b82f51dc2dbdbb08e1be30dbc677621693bc2486aadd899561dbe3ab45b
5
5
  SHA512:
6
- metadata.gz: e59a54556c98590dae490a3c468060cb38b4469db01145e8696c7bf9273affc76924ee1e79972127624dc8bb2a0f5d70b2ed8815d571eba40c615cc761d46493
7
- data.tar.gz: 5840cc106f27f682e74530c84182f6b75c2cd6ebc1b18a873bb6d8d3bca841842c743aa6c6c398469ca5445dcc00f35a8defb4612a550a73c2af52c22e7eb4cc
6
+ metadata.gz: 85d561f2980992818b056f8287b845896e85f5ba1ff4a4e38164b6004401d9d301104c3d1fc9bf62e8c7da3453fb042a26ee05d0ccdf70334db4b45f81bb1f0f
7
+ data.tar.gz: 03d9bb0f56ffc8fd3194cf3e87a098a32efb19274cbb2405157e9846dc0572ed9a906d64e59ee4477c41fcc567c8288fdf68f90d66cbed931a29523b2d3715b4
data/README.md CHANGED
@@ -38,7 +38,7 @@ Or install it yourself as:
38
38
 
39
39
  ```bash
40
40
  Usage: rubocop_pr [options]
41
- -r, --post-checkout [command] Running after each git checkout (default: "")
41
+ -k, --post-checkout [command] Running after each git checkout (default: "")
42
42
  -c, --continue Continue previous session (default: false)
43
43
  -b, --branch [branch] internal branch with '.rubocop_todo.yml' (default: 'rubocop_todo_branch')
44
44
  -m, --master [branch] branch which will be the base for all PR's (default: 'master')
@@ -51,6 +51,8 @@ Usage: rubocop_pr [options]
51
51
  -a, --issue-assignees [name] Issue assignees, separated by comma (default: "")
52
52
  -t [name], Pull request assignees, separated by comma (default: "")
53
53
  --pull-request-assignees
54
+ -r [name], Pull request reviewers, separated by comma (default: "")
55
+ --pull-request-reviewers
54
56
  -g, --repository [name] Set repository host (default: github)
55
57
  -l, --limit [limit] Limit the PS's for one run (default: 10)
56
58
  -h, --help Display help
@@ -27,7 +27,7 @@ module RubocopPr
27
27
 
28
28
  def exit_early?
29
29
  return true if options.continue && cop_was_processed? || git.status.blank?
30
- Rubocop.correct!
30
+ Rubocop.correct!(options[:all])
31
31
 
32
32
  git.checkout Rubocop::TODO_FILENAME
33
33
  git.status.blank?
@@ -40,7 +40,7 @@ module RubocopPr
40
40
  def add_post_checkout_option
41
41
  @options.post_checkout = ''
42
42
  msg = 'Running after each git checkout (default: "")'
43
- opts.on('-r [command]', '--post-checkout [command]', String, msg) do |v|
43
+ opts.on('-k [command]', '--post-checkout [command]', String, msg) do |v|
44
44
  @options.post_checkout = v
45
45
  end
46
46
  end
@@ -109,6 +109,14 @@ module RubocopPr
109
109
  end
110
110
  end
111
111
 
112
+ def add_pull_request_reviewers_option
113
+ @options.pull_request_reviewers = []
114
+ msg = 'Pull request reviewers, separated by comma (default: "")'
115
+ opts.on('-r [name] ', '--pull-request-reviewers [name]', Array, msg) do |v|
116
+ @options.pull_request_reviewers = v
117
+ end
118
+ end
119
+
112
120
  def add_repository_option
113
121
  @options.repository = 'github'
114
122
  msg = 'Set repository host (default: github)'
@@ -117,6 +125,13 @@ module RubocopPr
117
125
  end
118
126
  end
119
127
 
128
+ def add_all_option
129
+ @options.all = false
130
+ opts.on('-a', '--all', 'Use -A flag for rubocop command (default: false)') do |_v|
131
+ @options.all = true
132
+ end
133
+ end
134
+
120
135
  def add_continue_option
121
136
  @options.continue = false
122
137
  opts.on('-c', '--continue', 'Continue previous session (default: false)') do |_v|
@@ -44,7 +44,7 @@ module RubocopPr
44
44
  opt << "-m '#{body}'" unless body.blank?
45
45
  opt << "-a '#{assignees.join(',')}'" unless assignees.blank?
46
46
  opt << "-l '#{labels.join(',')}'" unless labels.blank?
47
- end.join(' ')
47
+ end
48
48
  end
49
49
 
50
50
  def default_title
@@ -78,10 +78,13 @@ module RubocopPr
78
78
 
79
79
  # The representation of the PR
80
80
  class PullRequest < Base
81
+ attr_reader :reviewers
82
+
81
83
  def initialize(cop:, **opt)
82
84
  super
83
85
  @assignees = Array opt[:pull_request_assignees]
84
86
  @labels = Array opt[:pull_request_labels]
87
+ @reviewers = Array opt[:pull_request_reviewers]
85
88
  end
86
89
 
87
90
  private
@@ -89,6 +92,12 @@ module RubocopPr
89
92
  def command
90
93
  'hub pull-request create'
91
94
  end
95
+
96
+ def cli_options
97
+ super.tap do |opt|
98
+ opt << "-r '#{reviewers.join(',')}'" unless reviewers.blank?
99
+ end
100
+ end
92
101
  end
93
102
 
94
103
  class << self
@@ -10,8 +10,8 @@ module RubocopPr
10
10
  system 'bundle exec rubocop --auto-gen-config'
11
11
  end
12
12
 
13
- def correct!
14
- system 'bundle exec rubocop -a'
13
+ def correct!(all)
14
+ system "bundle exec rubocop -#{all ? 'A' : 'a'}"
15
15
  end
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopPr
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.1.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kvokka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-16 00:00:00.000000000 Z
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport