rubocop_challenger 2.0.1 → 2.4.0

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: 6750425d109e73b835ecb0287d57861eb6a7cc54bbf48ae13aba5ebad670b01a
4
- data.tar.gz: 7c15913ce9010838d5ee7637d55b6a90e2cb097cadc0c31d12b94ed78b054b9a
3
+ metadata.gz: 3b24f35e2c475248e1e943b97cd33e10f21288d7b4bc23eda0a36183b61bc810
4
+ data.tar.gz: a61b3f9ca356153987f24d40a9e62204fcdef7301c95b28cb55d5954798df668
5
5
  SHA512:
6
- metadata.gz: 7fb4287bf9a2fddead8443186c84e4ab1083fbc66adb96f901b838803a8923e5aff67419b4d0b2c38bd9cdee170538693a1c993cb39295d8df5105f7a2a40a3d
7
- data.tar.gz: 272d169b16d6c4c40263405818d53d86e6189b97158728d835e4512db79ffb518c41eb1ae27a826425bb788ad2638baa176d11d76796eedc91c4245d47b1000b
6
+ metadata.gz: c174dde8680eb1001a08d3694a8a938100ae699e1c66d2ce4d94380dbc7b235f68dbedbd5a507c35a8e51af675f1132c943b538941917415fec27bdc8ee8bc60
7
+ data.tar.gz: af642d8970d3c720953991c25dd83bd575f2423919330087001ec841438003c9972a2301f51ddcc48a33cf86bcf98349d1b0ae772e4ade3dfa7059baa548b03f
data/.circleci/config.yml CHANGED
@@ -5,14 +5,14 @@
5
5
  version: 2.1
6
6
 
7
7
  orbs:
8
- ruby-orbs: sue445/ruby-orbs@1.6.1
8
+ ruby-orbs: sue445/ruby-orbs@1.6.2
9
9
  code-climate: rvla/code-climate@0.0.2
10
10
 
11
11
  references:
12
12
  - &ruby_version
13
13
  ruby_version:
14
14
  type: enum
15
- enum: ['2.5', '2.6', '2.7', '3.0', 'latest']
15
+ enum: ['2.6', '2.7', '3.0']
16
16
  default: '3.0'
17
17
 
18
18
  executors:
@@ -20,7 +20,7 @@ executors:
20
20
  parameters:
21
21
  <<: *ruby_version
22
22
  docker:
23
- - image: circleci/ruby:<< parameters.ruby_version >>
23
+ - image: cimg/ruby:<< parameters.ruby_version >>
24
24
  working_directory: ~/repo
25
25
 
26
26
  commands:
@@ -41,7 +41,7 @@ commands:
41
41
  - code-climate/format-coverage:
42
42
  input-type: simplecov
43
43
  prefix: $(readlink -f .)
44
- coverage-file: coverage/.resultset.json
44
+ coverage-file: coverage/coverage.json
45
45
  output: coverage/codeclimate.$CIRCLE_BUILD_NUM.json
46
46
  - persist_to_workspace:
47
47
  root: coverage
@@ -159,7 +159,7 @@ jobs:
159
159
  - code-climate/install
160
160
  - code-climate/sum-coverage:
161
161
  input: codeclimate.*.json
162
- parts: 5
162
+ parts: 3
163
163
  - code-climate/upload-coverage
164
164
  rubocop:
165
165
  executor: default
@@ -192,9 +192,6 @@ workflows:
192
192
 
193
193
  commit:
194
194
  jobs:
195
- - build:
196
- name: build_on_ruby_2.5
197
- ruby_version: '2.5'
198
195
  - build:
199
196
  name: build_on_ruby_2.6
200
197
  ruby_version: '2.6'
@@ -204,27 +201,20 @@ workflows:
204
201
  - build:
205
202
  name: build_on_ruby_3.0
206
203
  ruby_version: '3.0'
207
- - build:
208
- name: build_on_ruby_latest
209
- ruby_version: 'latest'
210
204
  - rubocop
211
205
  - yardoc
212
206
  - integration_testing
213
207
  - upload-coverage:
214
208
  requires:
215
- - build_on_ruby_2.5
216
209
  - build_on_ruby_2.6
217
210
  - build_on_ruby_2.7
218
211
  - build_on_ruby_3.0
219
- - build_on_ruby_latest
220
212
  - release:
221
213
  context: RubyGems API Key
222
214
  requires:
223
- - build_on_ruby_2.5
224
215
  - build_on_ruby_2.6
225
216
  - build_on_ruby_2.7
226
217
  - build_on_ruby_3.0
227
- - build_on_ruby_latest
228
218
  - rubocop
229
219
  filters:
230
220
  branches:
data/.gem_comet.yml CHANGED
@@ -1,12 +1,24 @@
1
1
  # [Usage]
2
2
  #
3
3
  # $ gem install gem_comet
4
+ # $ gem_comet init
4
5
  # $ gem_comet release {version number, like as "1.2.3"}
6
+ # $ gem_comet changelog
7
+ # $ gem_comet versions
5
8
 
6
- version: 1.1
9
+ version: 1.2
7
10
 
8
11
  release:
9
12
  base_branch: master
10
13
  release_branch: production
11
14
  version_file_path: lib/rubocop_challenger/version.rb
12
15
  changelog_file_path: CHANGELOG.md # optional
16
+ changelog:
17
+ categories:
18
+ - Feature
19
+ - Bugfix
20
+ - Security
21
+ - Breaking Change
22
+ - Rubocop Challenge
23
+ - Dependabot
24
+ - Misc
@@ -0,0 +1,31 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "08:00"
8
+ timezone: Japan
9
+ open-pull-requests-limit: 10
10
+ reviewers:
11
+ - ryz310
12
+ assignees:
13
+ - ryz310
14
+ labels:
15
+ - dependabot
16
+ ignore:
17
+ - dependency-name: simplecov
18
+ versions:
19
+ - ">= 0.19.a, < 0.20"
20
+ - dependency-name: rubocop
21
+ versions:
22
+ - 1.10.0
23
+ - 1.11.0
24
+ - 1.12.0
25
+ - 1.12.1
26
+ - dependency-name: rubocop-performance
27
+ versions:
28
+ - 1.10.0
29
+ - dependency-name: rubocop-rspec
30
+ versions:
31
+ - 2.2.0
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ require:
6
6
  inherit_from: .rubocop_todo.yml
7
7
 
8
8
  AllCops:
9
- TargetRubyVersion: 2.5
9
+ TargetRubyVersion: 2.6
10
10
  NewCops: enable
11
11
 
12
12
  Metrics/BlockLength:
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --exclude-limit 30 --no-auto-gen-timestamp`
3
- # using RuboCop version 1.7.0.
3
+ # using RuboCop version 1.23.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
data/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # Change log
2
2
 
3
+ ## v2.4.0 (Dec 26, 2021)
4
+
5
+ ### Feature
6
+
7
+ * [#550](https://github.com/ryz310/rubocop_challenger/pull/550) The end of ruby 2.5 support ([@ryz310](https://github.com/ryz310))
8
+
9
+ ### Rubocop Challenge
10
+
11
+ * [#544](https://github.com/ryz310/rubocop_challenger/pull/544) Gemspec/RequireMFA-20211115233051 ([@ryz310](https://github.com/ryz310))
12
+
13
+ ### Dependabot
14
+
15
+ * [#479](https://github.com/ryz310/rubocop_challenger/pull/479) ryz310/dependabot/bundler/rubocop-1.13.0 ([@ryz310](https://github.com/ryz310))
16
+ * [#482](https://github.com/ryz310/rubocop_challenger/pull/482) ryz310/dependabot/bundler/rubocop-rspec-2.3.0 ([@ryz310](https://github.com/ryz310))
17
+ * [#483](https://github.com/ryz310/rubocop_challenger/pull/483) ryz310/dependabot/add-v2-config-file ([@ryz310](https://github.com/ryz310))
18
+ * [#518](https://github.com/ryz310/rubocop_challenger/pull/518) Bump rake from 13.0.4 to 13.0.6 ([@ryz310](https://github.com/ryz310))
19
+ * [#537](https://github.com/ryz310/rubocop_challenger/pull/537) ryz310/dependabot/bundler/rubocop-rails-2.12.4 ([@ryz310](https://github.com/ryz310))
20
+ * [#542](https://github.com/ryz310/rubocop_challenger/pull/542) Bump addressable from 2.7.0 to 2.8.0 ([@ryz310](https://github.com/ryz310))
21
+ * [#543](https://github.com/ryz310/rubocop_challenger/pull/543) Bump rubocop-performance from 1.11.5 to 1.12.0 ([@ryz310](https://github.com/ryz310))
22
+ * [#546](https://github.com/ryz310/rubocop_challenger/pull/546) Bump yard from 0.9.26 to 0.9.27 ([@ryz310](https://github.com/ryz310))
23
+
24
+ ## v2.3.0 (Feb 23, 2021)
25
+
26
+ ### Feature
27
+
28
+ * [#465](https://github.com/ryz310/rubocop_challenger/pull/465) Add description whether the challenge is created by safe autocorrect or not ([@ryz310](https://github.com/ryz310))
29
+
30
+ ### Rubocop Challenge
31
+
32
+ * [#464](https://github.com/ryz310/rubocop_challenger/pull/464) Re-generate .rubocop_todo.yml with RuboCop v1.10.0 ([@ryz310](https://github.com/ryz310))
33
+
34
+ ### Dependabot
35
+
36
+ * [#453](https://github.com/ryz310/rubocop_challenger/pull/453) ryz310/dependabot/bundler/thor-1.1.0 ([@ryz310](https://github.com/ryz310))
37
+ * [#457](https://github.com/ryz310/rubocop_challenger/pull/457) ryz310/dependabot/bundler/rubocop-1.9.1 ([@ryz310](https://github.com/ryz310))
38
+ * [#461](https://github.com/ryz310/rubocop_challenger/pull/461) Update ruby-orbs orb to v1.6.2 ([@ryz310](https://github.com/ryz310))
39
+
40
+ ## v2.2.0 (Jan 11, 2021)
41
+
42
+ ### Feature
43
+
44
+ * [#449](https://github.com/ryz310/rubocop_challenger/pull/449) Add verbose option ([@ryz310](https://github.com/ryz310))
45
+
46
+ ### Dependabot
47
+
48
+ * [#447](https://github.com/ryz310/rubocop_challenger/pull/447) ryz310/dependabot/bundler/rubocop-1.8.1 ([@ryz310](https://github.com/ryz310))
49
+
50
+ ## v2.1.0 (Jan 11, 2021)
51
+
52
+ ### Feature
53
+
54
+ * [#441](https://github.com/ryz310/rubocop_challenger/pull/441) Improve PR description generation ([@ryz310](https://github.com/ryz310))
55
+
56
+ ### Rubocop Challenge
57
+
58
+ * [#442](https://github.com/ryz310/rubocop_challenger/pull/442) Re-generate .rubocop_todo.yml with RuboCop v1.8.0 ([@ryz310](https://github.com/ryz310))
59
+
60
+ ### Dependabot
61
+
62
+ * [#444](https://github.com/ryz310/rubocop_challenger/pull/444) Update simplecov requirement from = 0.17.1 to = 0.21.2 ([@ryz310](https://github.com/ryz310))
63
+
3
64
  ## v2.0.1 (Jan 06, 2021)
4
65
 
5
66
  ### Bugfix
data/Gemfile CHANGED
@@ -4,5 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
+ gem 'activesupport', '~> 6.1' # TODO: Remove this line at the end of Ruby 2.6 support
8
+
7
9
  # Specify your gem's dependencies in rubocop_challenger.gemspec
8
10
  gemspec
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_challenger (2.0.1)
5
- pr_comet (~> 0.4.0)
4
+ rubocop_challenger (2.4.0)
5
+ pr_comet (~> 0.5.1)
6
6
  rainbow
7
7
  rubocop (>= 0.87)
8
8
  rubocop-performance
@@ -15,38 +15,51 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- activesupport (6.1.0)
18
+ activesupport (6.1.4.4)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (>= 1.6, < 2)
21
21
  minitest (>= 5.1)
22
22
  tzinfo (~> 2.0)
23
23
  zeitwerk (~> 2.3)
24
- addressable (2.7.0)
24
+ addressable (2.8.0)
25
25
  public_suffix (>= 2.0.2, < 5.0)
26
- ast (2.4.1)
26
+ ast (2.4.2)
27
27
  byebug (11.1.3)
28
28
  coderay (1.1.3)
29
- concurrent-ruby (1.1.7)
30
- diff-lcs (1.4.4)
31
- docile (1.3.4)
32
- faraday (1.3.0)
29
+ concurrent-ruby (1.1.9)
30
+ diff-lcs (1.5.0)
31
+ docile (1.4.0)
32
+ faraday (1.8.0)
33
+ faraday-em_http (~> 1.0)
34
+ faraday-em_synchrony (~> 1.0)
35
+ faraday-excon (~> 1.1)
36
+ faraday-httpclient (~> 1.0.1)
33
37
  faraday-net_http (~> 1.0)
38
+ faraday-net_http_persistent (~> 1.1)
39
+ faraday-patron (~> 1.0)
40
+ faraday-rack (~> 1.0)
34
41
  multipart-post (>= 1.2, < 3)
35
- ruby2_keywords
36
- faraday-net_http (1.0.0)
37
- i18n (1.8.7)
42
+ ruby2_keywords (>= 0.0.4)
43
+ faraday-em_http (1.0.0)
44
+ faraday-em_synchrony (1.0.0)
45
+ faraday-excon (1.1.0)
46
+ faraday-httpclient (1.0.1)
47
+ faraday-net_http (1.0.1)
48
+ faraday-net_http_persistent (1.2.0)
49
+ faraday-patron (1.0.0)
50
+ faraday-rack (1.0.0)
51
+ i18n (1.8.11)
38
52
  concurrent-ruby (~> 1.0)
39
- json (2.5.1)
40
53
  method_source (1.0.0)
41
- minitest (5.14.2)
54
+ minitest (5.15.0)
42
55
  multipart-post (2.1.1)
43
- octokit (4.20.0)
56
+ octokit (4.21.0)
44
57
  faraday (>= 0.9)
45
58
  sawyer (~> 0.8.0, >= 0.5.3)
46
- parallel (1.20.1)
47
- parser (3.0.0.0)
59
+ parallel (1.21.0)
60
+ parser (3.0.3.2)
48
61
  ast (~> 2.4.1)
49
- pr_comet (0.4.0)
62
+ pr_comet (0.5.1)
50
63
  octokit
51
64
  rainbow
52
65
  pry (0.13.1)
@@ -58,9 +71,9 @@ GEM
58
71
  public_suffix (4.0.6)
59
72
  rack (2.2.3)
60
73
  rainbow (3.0.0)
61
- rake (13.0.3)
62
- regexp_parser (2.0.3)
63
- rexml (3.2.4)
74
+ rake (13.0.6)
75
+ regexp_parser (2.2.0)
76
+ rexml (3.2.5)
64
77
  rspec (3.10.0)
65
78
  rspec-core (~> 3.10.0)
66
79
  rspec-expectations (~> 3.10.0)
@@ -70,63 +83,66 @@ GEM
70
83
  rspec-expectations (3.10.1)
71
84
  diff-lcs (>= 1.2.0, < 2.0)
72
85
  rspec-support (~> 3.10.0)
73
- rspec-mocks (3.10.1)
86
+ rspec-mocks (3.10.2)
74
87
  diff-lcs (>= 1.2.0, < 2.0)
75
88
  rspec-support (~> 3.10.0)
76
- rspec-support (3.10.1)
89
+ rspec-support (3.10.3)
77
90
  rspec_junit_formatter (0.4.1)
78
91
  rspec-core (>= 2, < 4, != 2.12.0)
79
- rubocop (1.7.0)
92
+ rubocop (1.24.0)
80
93
  parallel (~> 1.10)
81
- parser (>= 2.7.1.5)
94
+ parser (>= 3.0.0.0)
82
95
  rainbow (>= 2.2.2, < 4.0)
83
96
  regexp_parser (>= 1.8, < 3.0)
84
97
  rexml
85
- rubocop-ast (>= 1.2.0, < 2.0)
98
+ rubocop-ast (>= 1.15.0, < 2.0)
86
99
  ruby-progressbar (~> 1.7)
87
- unicode-display_width (>= 1.4.0, < 2.0)
88
- rubocop-ast (1.4.0)
89
- parser (>= 2.7.1.5)
90
- rubocop-performance (1.9.2)
91
- rubocop (>= 0.90.0, < 2.0)
100
+ unicode-display_width (>= 1.4.0, < 3.0)
101
+ rubocop-ast (1.15.0)
102
+ parser (>= 3.0.1.1)
103
+ rubocop-performance (1.13.0)
104
+ rubocop (>= 1.7.0, < 2.0)
92
105
  rubocop-ast (>= 0.4.0)
93
- rubocop-rails (2.9.1)
106
+ rubocop-rails (2.13.0)
94
107
  activesupport (>= 4.2.0)
95
108
  rack (>= 1.1)
96
- rubocop (>= 0.90.0, < 2.0)
97
- rubocop-rake (0.5.1)
98
- rubocop
99
- rubocop-rspec (2.1.0)
109
+ rubocop (>= 1.7.0, < 2.0)
110
+ rubocop-rake (0.6.0)
100
111
  rubocop (~> 1.0)
101
- rubocop-ast (>= 1.1.0)
112
+ rubocop-rspec (2.6.0)
113
+ rubocop (~> 1.19)
102
114
  ruby-progressbar (1.11.0)
103
- ruby2_keywords (0.0.2)
115
+ ruby2_keywords (0.0.5)
104
116
  sawyer (0.8.2)
105
117
  addressable (>= 2.3.5)
106
118
  faraday (> 0.8, < 2.0)
107
- simplecov (0.17.1)
119
+ simplecov (0.21.2)
108
120
  docile (~> 1.1)
109
- json (>= 1.8, < 3)
110
- simplecov-html (~> 0.10.0)
111
- simplecov-html (0.10.2)
112
- thor (1.0.1)
121
+ simplecov-html (~> 0.11)
122
+ simplecov_json_formatter (~> 0.1)
123
+ simplecov-html (0.12.3)
124
+ simplecov_json_formatter (0.1.3)
125
+ thor (1.1.0)
113
126
  tzinfo (2.0.4)
114
127
  concurrent-ruby (~> 1.0)
115
- unicode-display_width (1.7.0)
116
- yard (0.9.26)
117
- zeitwerk (2.4.2)
128
+ unicode-display_width (2.1.0)
129
+ webrick (1.7.0)
130
+ yard (0.9.27)
131
+ webrick (~> 1.7.0)
132
+ zeitwerk (2.5.1)
118
133
 
119
134
  PLATFORMS
120
135
  ruby
121
136
 
122
137
  DEPENDENCIES
138
+ activesupport (~> 6.1)
123
139
  bundler (>= 2.0)
124
140
  pry-byebug
125
141
  rake (~> 13.0)
126
142
  rspec
127
143
  rspec_junit_formatter
128
144
  rubocop_challenger!
129
- simplecov (= 0.17.1)
145
+ simplecov (= 0.21.2)
130
146
 
131
147
  BUNDLED WITH
132
- 2.2.3
148
+ 2.2.22
data/README.md CHANGED
@@ -25,27 +25,7 @@ be continued to evolve.
25
25
 
26
26
  ## Usage
27
27
 
28
- ### 1. Edit your Gemfile
29
-
30
- If you do not specify the version of `rubocop` gem so you do not have to add `rubocop_challenger` gem in your Gemfile (**Recommended**).
31
-
32
- If you specify the version so put this line in your Gemfile.
33
-
34
- ```rb
35
- gem 'rubocop_challenger', group: :development, require: false
36
- ```
37
-
38
- ### 2. Setting GitHub personal access token
39
-
40
- GitHub personal access token is required for sending pull requests to your repository.
41
-
42
- 1. Go to [your account's settings page](https://github.com/settings/tokens) and [generate a new token](https://github.com/settings/tokens/new) with "repo" scope
43
- ![generate token](images/generate_token.png)
44
- 1. On [CircleCI](https://circleci.com) dashboard, go to your application's "Project Settings" -> "Environment Variables"
45
- 1. Add an environment variable `GITHUB_ACCESS_TOKEN` with your GitHub personal access token
46
- ![circleci environment variables](images/circleci_environment_variables.png)
47
-
48
- ### 3. Configure .circleci/config.yml
28
+ ### 1. Configure .circleci/config.yml
49
29
 
50
30
  Configure your `.circleci/config.yml` to run rubocop_challenger, for example:
51
31
 
@@ -56,7 +36,7 @@ version: 2
56
36
  jobs:
57
37
  rubocop_challenge:
58
38
  docker:
59
- - image: circleci/ruby:2.6-node-browsers
39
+ - image: circleci/ruby:3.0
60
40
  working_directory: ~/repo
61
41
  steps:
62
42
  - checkout
@@ -83,19 +63,24 @@ workflows:
83
63
  - rubocop_challenge
84
64
  ```
85
65
 
86
- If you added `rubocop_challenger` gem in your Gemfile so please modify script of installing and execution as following:
66
+ **Should not append `gem 'rubocop_challenger'` on your Gemfile.**
67
+ I have seen cases where errors occur due to compatibility issues with other gems.
87
68
 
88
- ```yml
89
- steps:
90
- - checkout
91
- - run:
92
- name: Rubocop Challenge
93
- command: |
94
- bundle install
95
- bundle exec rubocop_challenger go \
96
- --email=rubocop-challenger@example.com \
97
- --name="Rubocop Challenger"
98
- ```
69
+ ### 2. Setting GitHub personal access token
70
+
71
+ GitHub personal access token is required for sending pull requests to your repository.
72
+
73
+ 1. Go to [your account's settings page](https://github.com/settings/tokens) and [generate a new token](https://github.com/settings/tokens/new) with "repo" scope
74
+ ![generate token](images/generate_token.png)
75
+ 1. On [CircleCI](https://circleci.com) dashboard, go to your application's "Project Settings" -> "Environment Variables"
76
+ 1. Add an environment variable `GITHUB_ACCESS_TOKEN` with your GitHub personal access token
77
+ ![circleci environment variables](images/circleci_environment_variables.png)
78
+
79
+ ### Want to use on GitHub Actions?
80
+
81
+ It's introduced in the following blog. Thank you Mr. Takuya Yamaguchi!
82
+
83
+ See: [RuboCop ChallengerをGitHub Actionsで動かす](https://zenn.dev/yamat47/articles/219e14ebcf31a1d13ff4)
99
84
 
100
85
  ## CLI command references
101
86
 
@@ -117,30 +102,32 @@ Usage:
117
102
  rubocop_challenger go --email=EMAIL --name=NAME
118
103
 
119
104
  Options:
120
- --email=EMAIL # The Pull Request committer email
121
- --name=NAME # The Pull Request committer name
122
- f, [--file-path=FILE_PATH] # Set your ".rubocop_todo.yml" path
123
- # Default: .rubocop_todo.yml
124
- t, [--template=TEMPLATE] # A Pull Request template `erb` file path.You can use variable that `title`, `rubydoc_url`, `description` and `examples` into the erb file.
125
- [--mode=MODE] # Mode to select deletion target. You can choice "most_occurrence", "least_occurrence", or "random"
126
- # Default: most_occurrence
127
- b, [--base-branch=BASE_BRANCH] # The Branch to merge into
128
- # Default: master
129
- l, [--labels=one two three] # Label to give to Pull Request
130
- # Default: ["rubocop challenge"]
131
- [--project-column-name=PROJECT_COLUMN_NAME] # A project column name. You can add the created PR to the GitHub project
132
- [--project-id=N] # A target project ID. If does not supplied, this method will find a project which associated the repository. When the repository has multiple projects, you should supply this.
133
- [--no-create-pr] # No create a pull request (for testing)
134
- [--exclude-limit=N] # For how many exclude properties when creating the .rubocop_todo.yml
135
- [--auto-gen-timestamp], [--no-auto-gen-timestamp] # Include the date and time when creating the .rubocop_todo.yml
136
- # Default: true
105
+ --email=EMAIL # The Pull Request committer email
106
+ --name=NAME # The Pull Request committer name
107
+ f, [--file-path=FILE_PATH] # Set your ".rubocop_todo.yml" path
108
+ # Default: .rubocop_todo.yml
109
+ t, [--template=TEMPLATE] # A Pull Request template `erb` file path.You can use variable that `title`, `rubydoc_url`, `description` and `examples` into the erb file.
110
+ [--mode=MODE] # Mode to select deletion target. You can choice "most_occurrence", "least_occurrence", or "random"
111
+ # Default: most_occurrence
112
+ b, [--base-branch=BASE_BRANCH] # The Branch to merge into
113
+ # Default: master
114
+ l, [--labels=one two three] # Label to give to Pull Request
115
+ # Default: ["rubocop challenge"]
116
+ [--project-column-name=PROJECT_COLUMN_NAME] # A project column name. You can add the created PR to the GitHub project
117
+ [--project-id=N] # A target project ID. If does not supplied, this method will find a project which associated the repository. When the repository has multiple projects, you should supply this.
118
+ [--no-create-pr] # No create a pull request (for testing)
119
+ [--exclude-limit=N] # For how many exclude properties when creating the .rubocop_todo.yml
120
+ [--auto-gen-timestamp], [--no-auto-gen-timestamp] # Include the date and time when creating the .rubocop_todo.yml
121
+ # Default: true
122
+ [--only-safe-auto-correct], [--no-only-safe-auto-correct] # If given `true`, it executes `rubocop --auto-correct`,it means to correct safe cops only.
123
+ [--verbose], [--no-verbose] # Displays executing command.
137
124
 
138
125
  Run `$ rubocop --auto-correct` and create a PR to GitHub repo
139
126
  ```
140
127
 
141
128
  ## Requirement
142
129
 
143
- * Ruby 2.5 or higher
130
+ * Ruby 2.6 or higher
144
131
 
145
132
  ## Development
146
133
 
data/challenger.gemspec CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.required_ruby_version = '>= 2.5'
25
+ spec.required_ruby_version = '>= 2.6'
26
26
 
27
- spec.add_runtime_dependency 'pr_comet', '~> 0.4.0'
27
+ spec.add_runtime_dependency 'pr_comet', '~> 0.5.1'
28
28
  spec.add_runtime_dependency 'rainbow'
29
29
  spec.add_runtime_dependency 'rubocop', '>= 0.87'
30
30
  spec.add_runtime_dependency 'rubocop-performance'
@@ -39,5 +39,8 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'rake', '~> 13.0'
40
40
  spec.add_development_dependency 'rspec'
41
41
  spec.add_development_dependency 'rspec_junit_formatter'
42
- spec.add_development_dependency 'simplecov', '0.17.1'
42
+ spec.add_development_dependency 'simplecov', '0.21.2'
43
+ spec.metadata = {
44
+ 'rubygems_mfa_required' => 'true'
45
+ }
43
46
  end
@@ -6,6 +6,10 @@ module RubocopChallenger
6
6
  class Command
7
7
  include PrComet::CommandLine
8
8
 
9
+ def initialize(verbose: false)
10
+ @verbose = verbose
11
+ end
12
+
9
13
  # Executes `$ bundle update` which excludes not installed gems
10
14
  #
11
15
  # @param gem_names [Array<String>] The target gem names
@@ -66,6 +66,10 @@ module RubocopChallenger
66
66
  default: false,
67
67
  desc: 'If given `true`, it executes `rubocop --auto-correct`,' \
68
68
  'it means to correct safe cops only.'
69
+ option :verbose,
70
+ type: :boolean,
71
+ default: false,
72
+ desc: 'Displays executing command.'
69
73
  def go
70
74
  Go.new(options).exec
71
75
  rescue Errors::NoAutoCorrectableRule => e
@@ -14,13 +14,13 @@ module RubocopChallenger
14
14
 
15
15
  def generate
16
16
  <<~TEMPLATE
17
- #{ERB.new(template, nil, '-').result(binding)}
17
+ #{ERB.new(template, trim_mode: '-').result(binding)}
18
18
  #{FOOTER_TEXT}
19
19
  TEMPLATE
20
20
  rescue StandardError => e
21
21
  error_template = File.read(error_template_path)
22
22
  <<~TEMPLATE
23
- #{ERB.new(error_template, nil, '-').result(binding)}
23
+ #{ERB.new(error_template, trim_mode: '-').result(binding)}
24
24
  #{FOOTER_TEXT}
25
25
  TEMPLATE
26
26
  end
@@ -53,6 +53,10 @@ module RubocopChallenger
53
53
  yardoc.examples
54
54
  end
55
55
 
56
+ def safe_autocorrect?
57
+ yardoc.safe_autocorrect?
58
+ end
59
+
56
60
  def yardoc
57
61
  @yardoc ||= Rubocop::Yardoc.new(title)
58
62
  end
@@ -26,6 +26,8 @@ module RubocopChallenger
26
26
  # A target project ID. If does not supplied, this method will find a
27
27
  # project which associated the repository. When the repository has
28
28
  # multiple projects, you should supply this.
29
+ # @option verbose [Boolean]
30
+ # Displays executing command.
29
31
  def initialize(options)
30
32
  @options = options
31
33
  end
@@ -53,7 +55,7 @@ module RubocopChallenger
53
55
 
54
56
  # Executes `$ bundle update` for the rubocop and the associated gems
55
57
  def update_rubocop!
56
- bundler = Bundler::Command.new
58
+ bundler = Bundler::Command.new(verbose: options[:verbose])
57
59
  pull_request.commit! ':police_car: $ bundle update rubocop' do
58
60
  bundler.update(*RSPEC_GEMS)
59
61
  end
@@ -173,7 +175,8 @@ module RubocopChallenger
173
175
  labels: options[:labels],
174
176
  dry_run: options[:'no-create-pr'],
175
177
  project_column_name: options[:project_column_name],
176
- project_id: options[:project_id]
178
+ project_id: options[:project_id],
179
+ verbose: options[:verbose]
177
180
  }
178
181
  end
179
182
 
@@ -21,12 +21,15 @@ module RubocopChallenger
21
21
  # A target project ID. If does not supplied, this method will find a
22
22
  # project which associated the repository. When the repository has
23
23
  # multiple projects, you should supply this.
24
- def initialize(user_name:, user_email:, **options)
24
+ # @option verbose [Boolean]
25
+ # Displays executing command.
26
+ def initialize(user_name:, user_email:, **options) # rubocop:disable Metrics/MethodLength
25
27
  @pr_comet = PrComet.new(
26
28
  base: options[:base_branch],
27
29
  branch: "rubocop-challenge/#{timestamp}",
28
30
  user_name: user_name,
29
- user_email: user_email
31
+ user_email: user_email,
32
+ verbose: options[:verbose]
30
33
  )
31
34
  @labels = options[:labels]
32
35
  @dry_run = options[:dry_run]
@@ -4,12 +4,10 @@ module RubocopChallenger
4
4
  module Rubocop
5
5
  # To read YARD style documentation from rubocop gem source code
6
6
  class Yardoc
7
- def initialize(title)
7
+ def initialize(cop)
8
8
  load_rspec_gems!
9
- @cop_class = find_cop_class(title)
10
- YARD.parse(source_file_path)
11
- @yardoc = YARD::Registry.all(:class).first
12
- YARD::Registry.clear
9
+ @cop_class = find_cop_class(cop)
10
+ load_yardoc!
13
11
  end
14
12
 
15
13
  def description
@@ -20,6 +18,15 @@ module RubocopChallenger
20
18
  yardoc.tags('example').map { |tag| [tag.name, tag.text] }
21
19
  end
22
20
 
21
+ # Indicates whether the auto-correct a cop does is safe (equivalent) by design.
22
+ # If a cop is unsafe its auto-correct automatically becomes unsafe as well.
23
+ #
24
+ # @return [Boolean]
25
+ def safe_autocorrect?
26
+ config = RuboCop::ConfigLoader.default_configuration
27
+ cop_class.new(config).safe_autocorrect?
28
+ end
29
+
23
30
  private
24
31
 
25
32
  attr_reader :cop_class, :yardoc
@@ -36,12 +43,19 @@ module RubocopChallenger
36
43
  # Find a RuboCop class by cop name. It find from rubocop/rspec if cannot
37
44
  # find any class from rubocop gem.
38
45
  #
39
- # @param cop_name [String] The target cop name
40
- # @return [Class] Found RuboCop class
41
- def find_cop_class(cop_name)
42
- Object.const_get("RuboCop::Cop::#{cop_name.sub('/', '::')}")
46
+ # @param cop [String] The target cop name (e.g. "Performance/Size")
47
+ # @return [RuboCop::Cop] Found a RuboCop::Cop class
48
+ def find_cop_class(cop)
49
+ Object.const_get("RuboCop::Cop::#{cop.sub('/', '::')}")
43
50
  rescue NameError
44
- Object.const_get("RuboCop::Cop::RSpec::#{cop_name.sub('/', '::')}")
51
+ Object.const_get("RuboCop::Cop::RSpec::#{cop.sub('/', '::')}")
52
+ end
53
+
54
+ # Loads yardoc from the RuboCop::Cop class file
55
+ def load_yardoc!
56
+ YARD.parse(source_file_path)
57
+ @yardoc = YARD::Registry.all(:class).first
58
+ YARD::Registry.clear
45
59
  end
46
60
 
47
61
  def instance_methods
@@ -52,11 +66,15 @@ module RubocopChallenger
52
66
  end
53
67
 
54
68
  def source_file_path
55
- instance_methods
56
- .map { |m| cop_class.instance_method(m).source_location }
57
- .reject(&:nil?)
58
- .map(&:first)
59
- .first
69
+ if Object.respond_to?(:const_source_location)
70
+ Object.const_source_location(cop_class.name).first
71
+ else
72
+ instance_methods
73
+ .map { |m| cop_class.instance_method(m).source_location }
74
+ .compact
75
+ .map(&:first)
76
+ .first
77
+ end
60
78
  end
61
79
  end
62
80
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopChallenger
4
- VERSION = '2.0.1'
4
+ VERSION = '2.4.0'
5
5
  end
@@ -2,6 +2,14 @@
2
2
 
3
3
  [<%= title %>](<%= rubydoc_url %>)
4
4
 
5
+ <% if safe_autocorrect? -%>
6
+ **Safe autocorrect: true**
7
+ :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
8
+ <% else -%>
9
+ **Safe autocorrect: false**
10
+ :warning: The auto-correct a cop can yield false positives by design.
11
+ <% end -%>
12
+
5
13
  ## Description
6
14
 
7
15
  > ### Overview
@@ -2,6 +2,14 @@
2
2
 
3
3
  [<%= title %>](<%= rubydoc_url %>)
4
4
 
5
+ <% if safe_autocorrect? -%>
6
+ **Safe autocorrect: true**
7
+ :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
8
+ <% else -%>
9
+ **Safe autocorrect: false**
10
+ :warning: The auto-correct a cop can yield false positives by design.
11
+ <% end -%>
12
+
5
13
  ## Description
6
14
 
7
15
  > ### Overview
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Description
6
6
 
7
- Sorry! Something went wrong! :bow:
7
+ Failed to create the cop description.
8
8
  Please report bugs [here](https://github.com/ryz310/rubocop_challenger/issues/new?assignees=ryz310&labels=bug&template=bug_report.md) with following error information.
9
9
 
10
10
  ```
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_challenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryosuke_sato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-06 00:00:00.000000000 Z
11
+ date: 2021-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pr_comet
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.0
19
+ version: 0.5.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.0
26
+ version: 0.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rainbow
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 0.17.1
215
+ version: 0.21.2
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 0.17.1
222
+ version: 0.21.2
223
223
  description: Make a clean your rubocop_todo.yml with CI
224
224
  email:
225
225
  - r-sato@feedforce.jp
@@ -229,10 +229,10 @@ extensions: []
229
229
  extra_rdoc_files: []
230
230
  files:
231
231
  - ".circleci/config.yml"
232
- - ".dependabot/config.yml"
233
232
  - ".envrc.skeleton"
234
233
  - ".gem_comet.yml"
235
234
  - ".github/ISSUE_TEMPLATE/bug_report.md"
235
+ - ".github/dependabot.yml"
236
236
  - ".gitignore"
237
237
  - ".rspec"
238
238
  - ".rubocop.yml"
@@ -276,7 +276,8 @@ files:
276
276
  homepage: https://github.com/ryz310/rubocop_challenger
277
277
  licenses:
278
278
  - MIT
279
- metadata: {}
279
+ metadata:
280
+ rubygems_mfa_required: 'true'
280
281
  post_install_message:
281
282
  rdoc_options: []
282
283
  require_paths:
@@ -285,14 +286,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
285
286
  requirements:
286
287
  - - ">="
287
288
  - !ruby/object:Gem::Version
288
- version: '2.5'
289
+ version: '2.6'
289
290
  required_rubygems_version: !ruby/object:Gem::Requirement
290
291
  requirements:
291
292
  - - ">="
292
293
  - !ruby/object:Gem::Version
293
294
  version: '0'
294
295
  requirements: []
295
- rubygems_version: 3.2.3
296
+ rubygems_version: 3.2.32
296
297
  signing_key:
297
298
  specification_version: 4
298
299
  summary: Make a clean your rubocop_todo.yml with CI
@@ -1,18 +0,0 @@
1
- version: 1
2
- update_configs:
3
- - package_manager: "ruby:bundler"
4
- directory: "/"
5
- update_schedule: "live"
6
- default_reviewers:
7
- - "ryz310"
8
- default_assignees:
9
- - "ryz310"
10
- default_labels:
11
- - "dependabot"
12
- automerged_updates:
13
- - match:
14
- dependency_type: "development"
15
- update_type: "all"
16
- - match:
17
- dependency_type: "production"
18
- update_type: "semver:patch"