rubocop_challenger 2.0.0.pre7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +18 -10
- data/.dependabot/config.yml +18 -0
- data/.gem_comet.yml +12 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +26 -0
- data/.rubocop.yml +10 -2
- data/.rubocop_challenge.yml +3 -0
- data/.rubocop_todo.yml +2 -2
- data/CHANGELOG.md +290 -0
- data/Gemfile.lock +88 -54
- data/README.md +1 -1
- data/challenger.gemspec +9 -5
- data/lib/rubocop_challenger.rb +8 -8
- data/lib/rubocop_challenger/bundler/command.rb +1 -1
- data/lib/rubocop_challenger/cli.rb +5 -0
- data/lib/rubocop_challenger/github/pr_template.rb +18 -3
- data/lib/rubocop_challenger/go.rb +36 -27
- data/lib/rubocop_challenger/pull_request.rb +1 -1
- data/lib/rubocop_challenger/rubocop/challenge.rb +7 -6
- data/lib/rubocop_challenger/rubocop/command.rb +6 -2
- data/lib/rubocop_challenger/rubocop/rule.rb +1 -1
- data/lib/rubocop_challenger/rubocop/yardoc.rb +10 -0
- data/lib/rubocop_challenger/version.rb +1 -1
- data/lib/templates/error.md.erb +18 -0
- metadata +53 -20
- data/bin/release +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6750425d109e73b835ecb0287d57861eb6a7cc54bbf48ae13aba5ebad670b01a
|
4
|
+
data.tar.gz: 7c15913ce9010838d5ee7637d55b6a90e2cb097cadc0c31d12b94ed78b054b9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb4287bf9a2fddead8443186c84e4ab1083fbc66adb96f901b838803a8923e5aff67419b4d0b2c38bd9cdee170538693a1c993cb39295d8df5105f7a2a40a3d
|
7
|
+
data.tar.gz: 272d169b16d6c4c40263405818d53d86e6189b97158728d835e4512db79ffb518c41eb1ae27a826425bb788ad2638baa176d11d76796eedc91c4245d47b1000b
|
data/.circleci/config.yml
CHANGED
@@ -5,22 +5,22 @@
|
|
5
5
|
version: 2.1
|
6
6
|
|
7
7
|
orbs:
|
8
|
-
ruby-orbs: sue445/ruby-orbs@1.
|
8
|
+
ruby-orbs: sue445/ruby-orbs@1.6.1
|
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.
|
16
|
-
default: '
|
15
|
+
enum: ['2.5', '2.6', '2.7', '3.0', 'latest']
|
16
|
+
default: '3.0'
|
17
17
|
|
18
18
|
executors:
|
19
19
|
default:
|
20
20
|
parameters:
|
21
21
|
<<: *ruby_version
|
22
22
|
docker:
|
23
|
-
- image: circleci/ruby:<< parameters.ruby_version
|
23
|
+
- image: circleci/ruby:<< parameters.ruby_version >>
|
24
24
|
working_directory: ~/repo
|
25
25
|
|
26
26
|
commands:
|
@@ -128,6 +128,9 @@ commands:
|
|
128
128
|
<<: *ruby_version
|
129
129
|
steps:
|
130
130
|
- checkout
|
131
|
+
- run:
|
132
|
+
name: Install Bundler 2.x
|
133
|
+
command: gem install bundler:2.1.4
|
131
134
|
- ruby-orbs/bundle-install:
|
132
135
|
cache_key_prefix: v1-dependencies-<< parameters.ruby_version >>
|
133
136
|
test_and_build:
|
@@ -156,7 +159,7 @@ jobs:
|
|
156
159
|
- code-climate/install
|
157
160
|
- code-climate/sum-coverage:
|
158
161
|
input: codeclimate.*.json
|
159
|
-
parts:
|
162
|
+
parts: 5
|
160
163
|
- code-climate/upload-coverage
|
161
164
|
rubocop:
|
162
165
|
executor: default
|
@@ -189,15 +192,18 @@ workflows:
|
|
189
192
|
|
190
193
|
commit:
|
191
194
|
jobs:
|
192
|
-
- build:
|
193
|
-
name: build_on_ruby_2.4
|
194
|
-
ruby_version: '2.4'
|
195
195
|
- build:
|
196
196
|
name: build_on_ruby_2.5
|
197
197
|
ruby_version: '2.5'
|
198
198
|
- build:
|
199
199
|
name: build_on_ruby_2.6
|
200
200
|
ruby_version: '2.6'
|
201
|
+
- build:
|
202
|
+
name: build_on_ruby_2.7
|
203
|
+
ruby_version: '2.7'
|
204
|
+
- build:
|
205
|
+
name: build_on_ruby_3.0
|
206
|
+
ruby_version: '3.0'
|
201
207
|
- build:
|
202
208
|
name: build_on_ruby_latest
|
203
209
|
ruby_version: 'latest'
|
@@ -206,16 +212,18 @@ workflows:
|
|
206
212
|
- integration_testing
|
207
213
|
- upload-coverage:
|
208
214
|
requires:
|
209
|
-
- build_on_ruby_2.4
|
210
215
|
- build_on_ruby_2.5
|
211
216
|
- build_on_ruby_2.6
|
217
|
+
- build_on_ruby_2.7
|
218
|
+
- build_on_ruby_3.0
|
212
219
|
- build_on_ruby_latest
|
213
220
|
- release:
|
214
221
|
context: RubyGems API Key
|
215
222
|
requires:
|
216
|
-
- build_on_ruby_2.4
|
217
223
|
- build_on_ruby_2.5
|
218
224
|
- build_on_ruby_2.6
|
225
|
+
- build_on_ruby_2.7
|
226
|
+
- build_on_ruby_3.0
|
219
227
|
- build_on_ruby_latest
|
220
228
|
- rubocop
|
221
229
|
filters:
|
@@ -0,0 +1,18 @@
|
|
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"
|
data/.gem_comet.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# [Usage]
|
2
|
+
#
|
3
|
+
# $ gem install gem_comet
|
4
|
+
# $ gem_comet release {version number, like as "1.2.3"}
|
5
|
+
|
6
|
+
version: 1.1
|
7
|
+
|
8
|
+
release:
|
9
|
+
base_branch: master
|
10
|
+
release_branch: production
|
11
|
+
version_file_path: lib/rubocop_challenger/version.rb
|
12
|
+
changelog_file_path: CHANGELOG.md # optional
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: ryz310
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
A clear and concise description of what the bug is.
|
12
|
+
|
13
|
+
**Error information**
|
14
|
+
Add error message and backtrace if you can see.
|
15
|
+
|
16
|
+
**RubocopChallenger version (please complete the following information):**
|
17
|
+
- [e.g. 1.2.3]
|
18
|
+
|
19
|
+
**RuboCop versions (please complete the following information):**
|
20
|
+
- rubocop: [e.g. 1.2.3]
|
21
|
+
- rubocop-performance: [e.g. 1.2.3]
|
22
|
+
- rubocop-rails: [e.g. 1.2.3]
|
23
|
+
- rubocop-rspec: [e.g. 1.2.3]
|
24
|
+
|
25
|
+
**Additional context**
|
26
|
+
Add any other context about the problem here.
|
data/.rubocop.yml
CHANGED
@@ -1,21 +1,29 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-performance
|
3
|
+
- rubocop-rake
|
3
4
|
- rubocop-rspec
|
4
5
|
|
5
6
|
inherit_from: .rubocop_todo.yml
|
6
7
|
|
7
8
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.
|
9
|
+
TargetRubyVersion: 2.5
|
10
|
+
NewCops: enable
|
9
11
|
|
10
12
|
Metrics/BlockLength:
|
11
13
|
Exclude:
|
12
14
|
- 'challenger.gemspec'
|
13
15
|
- 'spec/**/*'
|
14
16
|
|
17
|
+
Naming/VariableNumber:
|
18
|
+
EnforcedStyle: snake_case
|
19
|
+
|
15
20
|
# For integration testing
|
16
21
|
RSpec/MultipleExpectations:
|
17
22
|
Exclude:
|
18
|
-
- 'spec/rubocop_challenger/cli_spec.rb'
|
23
|
+
- 'spec/lib/rubocop_challenger/cli_spec.rb'
|
24
|
+
|
25
|
+
RSpec/MultipleMemoizedHelpers:
|
26
|
+
Max: 10
|
19
27
|
|
20
28
|
RSpec/NestedGroups:
|
21
29
|
Max: 4
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
#
|
2
|
+
# `rubocop --auto-gen-config --exclude-limit 30 --no-auto-gen-timestamp`
|
3
|
+
# using RuboCop version 1.7.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
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## v2.0.1 (Jan 06, 2021)
|
4
|
+
|
5
|
+
### Bugfix
|
6
|
+
|
7
|
+
* [#437](https://github.com/ryz310/rubocop_challenger/pull/437) Fix keyword argument expanding for Ruby 3.0 ([@ryz310](https://github.com/ryz310))
|
8
|
+
|
9
|
+
## v2.0.0 (Jan 04, 2021)
|
10
|
+
|
11
|
+
### Feature
|
12
|
+
|
13
|
+
* [#183](https://github.com/ryz310/rubocop_challenger/pull/183) Implement the flow that create a PR which re-generate ".rubocop_todo.yml" ([@ryz310](https://github.com/ryz310))
|
14
|
+
* [#187](https://github.com/ryz310/rubocop_challenger/pull/187) Bundle update rubocop ([@ryz310](https://github.com/ryz310))
|
15
|
+
* [#208](https://github.com/ryz310/rubocop_challenger/pull/208) Render links for release note and compare page ([@ryz310](https://github.com/ryz310))
|
16
|
+
* [#217](https://github.com/ryz310/rubocop_challenger/pull/217) Support auto gem config options ([@ryz310](https://github.com/ryz310))
|
17
|
+
* [#250](https://github.com/ryz310/rubocop_challenger/pull/250) Add error reporting feature ([@ryz310](https://github.com/ryz310))
|
18
|
+
* [#253](https://github.com/ryz310/rubocop_challenger/pull/253) Add information of the rubocop challenge ([@ryz310](https://github.com/ryz310))
|
19
|
+
* [#288](https://github.com/ryz310/rubocop_challenger/pull/288) Support ruby 2.7 ([@ryz310](https://github.com/ryz310))
|
20
|
+
* [#362](https://github.com/ryz310/rubocop_challenger/pull/362) Use rubocop auto correct all ([@ryz310](https://github.com/ryz310))
|
21
|
+
* [#398](https://github.com/ryz310/rubocop_challenger/pull/398) Add auto correct safe option ([@ryz310](https://github.com/ryz310))
|
22
|
+
* [#432](https://github.com/ryz310/rubocop_challenger/pull/432) Support ruby 3.0 ([@ryz310](https://github.com/ryz310))
|
23
|
+
|
24
|
+
### Bugfix
|
25
|
+
|
26
|
+
* [#212](https://github.com/ryz310/rubocop_challenger/pull/212) Fix the version of pr_comet ([@ryz310](https://github.com/ryz310))
|
27
|
+
* [#231](https://github.com/ryz310/rubocop_challenger/pull/231) Fix the way of requirements loading for optional dependencies ([@ryz310](https://github.com/ryz310))
|
28
|
+
* [#238](https://github.com/ryz310/rubocop_challenger/pull/238) Fix/load error of the updated gems ([@ryz310](https://github.com/ryz310))
|
29
|
+
* [#363](https://github.com/ryz310/rubocop_challenger/pull/363) Require rubocop-rails gem ([@ryz310](https://github.com/ryz310))
|
30
|
+
|
31
|
+
### Breaking Change
|
32
|
+
|
33
|
+
* [#180](https://github.com/ryz310/rubocop_challenger/pull/180) Farewell ruby 2.3 ([@ryz310](https://github.com/ryz310))
|
34
|
+
* [#184](https://github.com/ryz310/rubocop_challenger/pull/184) Remove base branch option ([@ryz310](https://github.com/ryz310))
|
35
|
+
* [#396](https://github.com/ryz310/rubocop_challenger/pull/396) End of support for Ruby 2.4 ([@ryz310](https://github.com/ryz310))
|
36
|
+
|
37
|
+
### Rubocop Challenge
|
38
|
+
|
39
|
+
* [#228](https://github.com/ryz310/rubocop_challenger/pull/228) Style/WordArray-20190625233039 ([@ryz310](https://github.com/ryz310))
|
40
|
+
* [#235](https://github.com/ryz310/rubocop_challenger/pull/235) Performance/RegexpMatch-20190729233033 ([@ryz310](https://github.com/ryz310))
|
41
|
+
* [#236](https://github.com/ryz310/rubocop_challenger/pull/236) Layout/SpaceAroundOperators-20190731233025 ([@ryz310](https://github.com/ryz310))
|
42
|
+
* [#317](https://github.com/ryz310/rubocop_challenger/pull/317) Performance/StartWith-20200523233027 ([@ryz310](https://github.com/ryz310))
|
43
|
+
* [#427](https://github.com/ryz310/rubocop_challenger/pull/427) Re-generate .rubocop_todo.yml with RuboCop v1.7.0 ([@ryz310](https://github.com/ryz310))
|
44
|
+
|
45
|
+
### Dependabot
|
46
|
+
|
47
|
+
* [#242](https://github.com/ryz310/rubocop_challenger/pull/242) ryz310/dependabot/bundler/rake-tw-13.0 ([@ryz310](https://github.com/ryz310))
|
48
|
+
* [#244](https://github.com/ryz310/rubocop_challenger/pull/244) ryz310/dependabot/bundler/simplecov-0.17.1 ([@ryz310](https://github.com/ryz310))
|
49
|
+
* [#245](https://github.com/ryz310/rubocop_challenger/pull/245) ryz310/dependabot/bundler/pr_comet-gte-0.2-and-lt-0.4 ([@ryz310](https://github.com/ryz310))
|
50
|
+
* [#271](https://github.com/ryz310/rubocop_challenger/pull/271) Bump thor from 1.0.0 to 1.0.1 ([@ryz310](https://github.com/ryz310))
|
51
|
+
* [#303](https://github.com/ryz310/rubocop_challenger/pull/303) ryz310/dependabot/bundler/pry-byebug-3.9.0 ([@ryz310](https://github.com/ryz310))
|
52
|
+
* [#376](https://github.com/ryz310/rubocop_challenger/pull/376) ryz310/dependabot/bundler/rspec-3.10.0 ([@ryz310](https://github.com/ryz310))
|
53
|
+
* [#414](https://github.com/ryz310/rubocop_challenger/pull/414) ryz310/dependabot/bundler/rubocop-rspec-2.0.1 ([@ryz310](https://github.com/ryz310))
|
54
|
+
* [#421](https://github.com/ryz310/rubocop_challenger/pull/421) ryz310/dependabot/bundler/rubocop-1.6.1 ([@ryz310](https://github.com/ryz310))
|
55
|
+
* [#423](https://github.com/ryz310/rubocop_challenger/pull/423) ryz310/dependabot/bundler/rubocop-rails-2.9.1 ([@ryz310](https://github.com/ryz310))
|
56
|
+
* [#426](https://github.com/ryz310/rubocop_challenger/pull/426) ryz310/dependabot/bundler/rake-13.0.3 ([@ryz310](https://github.com/ryz310))
|
57
|
+
* [#428](https://github.com/ryz310/rubocop_challenger/pull/428) ryz310/dependabot/bundler/yard-0.9.26 ([@ryz310](https://github.com/ryz310))
|
58
|
+
* [#431](https://github.com/ryz310/rubocop_challenger/pull/431) ryz310/dependabot/bundler/rubocop-performance-1.9.2 ([@ryz310](https://github.com/ryz310))
|
59
|
+
|
60
|
+
### Security
|
61
|
+
|
62
|
+
* [#230](https://github.com/ryz310/rubocop_challenger/pull/230) Bump yard from 0.9.19 to 0.9.20 ([@ryz310](https://github.com/ryz310))
|
63
|
+
|
64
|
+
### Misc
|
65
|
+
|
66
|
+
* [#178](https://github.com/ryz310/rubocop_challenger/pull/178) Use #abort instead of #puts and #exit! ([@ryz310](https://github.com/ryz310))
|
67
|
+
* [#181](https://github.com/ryz310/rubocop_challenger/pull/181) Remove waffle.io badge ([@ryz310](https://github.com/ryz310))
|
68
|
+
* [#185](https://github.com/ryz310/rubocop_challenger/pull/185) Improve code coverage and fix implements ([@ryz310](https://github.com/ryz310))
|
69
|
+
* [#186](https://github.com/ryz310/rubocop_challenger/pull/186) Use #abort instead of #exit! ([@ryz310](https://github.com/ryz310))
|
70
|
+
* [#192](https://github.com/ryz310/rubocop_challenger/pull/192) Extract with pr comet ([@ryz310](https://github.com/ryz310))
|
71
|
+
* [#216](https://github.com/ryz310/rubocop_challenger/pull/216) Use rainbow gem ([@ryz310](https://github.com/ryz310))
|
72
|
+
* [#218](https://github.com/ryz310/rubocop_challenger/pull/218) Add pull request to GitHub project on execute ([@ryz310](https://github.com/ryz310))
|
73
|
+
* [#219](https://github.com/ryz310/rubocop_challenger/pull/219) Add auto updating target gems ([@ryz310](https://github.com/ryz310))
|
74
|
+
* [#223](https://github.com/ryz310/rubocop_challenger/pull/223) Support base branch option ([@ryz310](https://github.com/ryz310))
|
75
|
+
* [#227](https://github.com/ryz310/rubocop_challenger/pull/227) Migrate circle ci version to 2.1 ([@ryz310](https://github.com/ryz310))
|
76
|
+
* [#239](https://github.com/ryz310/rubocop_challenger/pull/239) Introduce gem comet ([@ryz310](https://github.com/ryz310))
|
77
|
+
* [#294](https://github.com/ryz310/rubocop_challenger/pull/294) Update ruby-orbs orb to v1.6.0 ([@ryz310](https://github.com/ryz310))
|
78
|
+
* [#304](https://github.com/ryz310/rubocop_challenger/pull/304) Edit dependabot configuration ([@ryz310](https://github.com/ryz310))
|
79
|
+
* [#433](https://github.com/ryz310/rubocop_challenger/pull/433) Update `pr_comet` ([@ryz310](https://github.com/ryz310))
|
80
|
+
|
81
|
+
## v1.2.0 (Feb 27, 2019)
|
82
|
+
|
83
|
+
### Feature
|
84
|
+
|
85
|
+
* Challenge incompleted list ([#170](https://github.com/ryz310/rubocop_challenger/pull/170))
|
86
|
+
|
87
|
+
### Bugfix
|
88
|
+
|
89
|
+
* Fix exit code when no more auto-correctable rule ([#175](https://github.com/ryz310/rubocop_challenger/pull/175))
|
90
|
+
|
91
|
+
### Breaking Change
|
92
|
+
|
93
|
+
* Remove "regenerate-rubocop-todo" option ([#170](https://github.com/ryz310/rubocop_challenger/pull/170))
|
94
|
+
|
95
|
+
## v1.1.2 (Feb 21, 2019)
|
96
|
+
|
97
|
+
### Feature
|
98
|
+
|
99
|
+
* Re-generate .rubocop_todo.yml on pre-challenge ([#169](https://github.com/ryz310/rubocop_challenger/pull/169))
|
100
|
+
|
101
|
+
## v1.1.1 (Jan 17, 2019)
|
102
|
+
|
103
|
+
### Bugfix
|
104
|
+
|
105
|
+
* Fix encountering name error when finding a cop class by cop name ([#164](https://github.com/ryz310/rubocop_challenger/pull/164))
|
106
|
+
|
107
|
+
### Misc
|
108
|
+
|
109
|
+
* Configure Renovate ([#162](https://github.com/ryz310/rubocop_challenger/pull/162))
|
110
|
+
|
111
|
+
## v1.1.0 (Dec 29, 2018)
|
112
|
+
|
113
|
+
### Feature
|
114
|
+
|
115
|
+
* Support ruby 2.6 ([#156](https://github.com/ryz310/rubocop_challenger/pull/156))
|
116
|
+
|
117
|
+
### Misc
|
118
|
+
|
119
|
+
* Change emoji on the commit message ([#158](https://github.com/ryz310/rubocop_challenger/pull/158))
|
120
|
+
|
121
|
+
## v1.0.0 (Dec 3, 2018)
|
122
|
+
|
123
|
+
Release v1.0.0 :tada:
|
124
|
+
|
125
|
+
## v1.0.0.pre4 (Nov 26, 2018)
|
126
|
+
|
127
|
+
### Security
|
128
|
+
|
129
|
+
* Add quiet option on git push command ([#149](https://github.com/ryz310/rubocop_challenger/pull/149))
|
130
|
+
|
131
|
+
### Misc
|
132
|
+
|
133
|
+
* Add yard testing flow ([#150](https://github.com/ryz310/rubocop_challenger/pull/150))
|
134
|
+
* Add jailbreak script ([#151](https://github.com/ryz310/rubocop_challenger/pull/151))
|
135
|
+
|
136
|
+
## v1.0.0.pre3 (Nov 17, 2018)
|
137
|
+
|
138
|
+
### Feature
|
139
|
+
|
140
|
+
* Output the result in the execution ([#139](https://github.com/ryz310/rubocop_challenger/pull/139))
|
141
|
+
* Colorize error log ([#145](https://github.com/ryz310/rubocop_challenger/pull/145))
|
142
|
+
|
143
|
+
### Bugfix
|
144
|
+
|
145
|
+
* Filter access token in the command logging ([#144](https://github.com/ryz310/rubocop_challenger/pull/144))
|
146
|
+
|
147
|
+
## v1.0.0.pre2 (Nov 15, 2018)
|
148
|
+
|
149
|
+
### Feature
|
150
|
+
|
151
|
+
* Support private repository ([#132](https://github.com/ryz310/rubocop_challenger/pull/132))
|
152
|
+
* Support old git version ([#133](https://github.com/ryz310/rubocop_challenger/pull/133))
|
153
|
+
|
154
|
+
### Misc
|
155
|
+
|
156
|
+
* Add Github::Client#add_labels spec ([#131](https://github.com/ryz310/rubocop_challenger/pull/131))
|
157
|
+
* Remove a unnecessary option ([#134](https://github.com/ryz310/rubocop_challenger/pull/134))
|
158
|
+
|
159
|
+
## v1.0.0.pre (Nov 13, 2018)
|
160
|
+
|
161
|
+
### Feature
|
162
|
+
|
163
|
+
* Use octokit ([#121](https://github.com/ryz310/rubocop_challenger/pull/121))
|
164
|
+
|
165
|
+
### Breaking Change
|
166
|
+
|
167
|
+
* Change `--regenerate-rubocop-todo` option default value to true
|
168
|
+
|
169
|
+
### Misc
|
170
|
+
|
171
|
+
* Modify gem version validator ([#127](https://github.com/ryz310/rubocop_challenger/pull/127))
|
172
|
+
|
173
|
+
## v0.5.2 (Nov 4, 2018)
|
174
|
+
|
175
|
+
### Misc
|
176
|
+
|
177
|
+
* Install code climate ([#116](https://github.com/ryz310/rubocop_challenger/pull/116))
|
178
|
+
* Fix coveralls badge URL ([#117](https://github.com/ryz310/rubocop_challenger/pull/117))
|
179
|
+
* Uninstall coveralls ([#118](https://github.com/ryz310/rubocop_challenger/pull/118))
|
180
|
+
|
181
|
+
## v0.5.1 (Nov 1, 2018)
|
182
|
+
|
183
|
+
### Misc
|
184
|
+
|
185
|
+
* Style/MutableConstant at Tue Oct 30 23:30:33 UTC 2018 ([#106](https://github.com/ryz310/rubocop_challenger/pull/106))
|
186
|
+
* Install coveralls ([#107](https://github.com/ryz310/rubocop_challenger/pull/107))
|
187
|
+
* Definition of Metrics/BlockLength ([#109](https://github.com/ryz310/rubocop_challenger/pull/109))
|
188
|
+
* Fix offense of RSpec/ExampleLength ([#110](https://github.com/ryz310/rubocop_challenger/pull/110))
|
189
|
+
* Fix offense of Style/Documentation ([#111](https://github.com/ryz310/rubocop_challenger/pull/111))
|
190
|
+
* Fix offense of Metrics/LineLength ([#112](https://github.com/ryz310/rubocop_challenger/pull/112))
|
191
|
+
* Fix that testing target is wrong ([#113](https://github.com/ryz310/rubocop_challenger/pull/113))
|
192
|
+
|
193
|
+
## v0.5.0 (Oct 30, 2018)
|
194
|
+
|
195
|
+
### Feature
|
196
|
+
|
197
|
+
* Use bundle exec ([#100](https://github.com/ryz310/rubocop_challenger/pull/100))
|
198
|
+
|
199
|
+
### Breaking Change
|
200
|
+
|
201
|
+
* Return example name ([#101](https://github.com/ryz310/rubocop_challenger/pull/101))
|
202
|
+
|
203
|
+
### Misc
|
204
|
+
|
205
|
+
* Layout/AlignHash at Sun Oct 28 23:30:20 UTC 2018 ([#97](https://github.com/ryz310/rubocop_challenger/pull/97))
|
206
|
+
* Add Rubocop Challenge example to the README.md ([#98](https://github.com/ryz310/rubocop_challenger/pull/98))
|
207
|
+
* Update bundle when create release PR ([#103](https://github.com/ryz310/rubocop_challenger/pull/103))
|
208
|
+
|
209
|
+
## v0.4.1 (Oct 28, 2018)
|
210
|
+
|
211
|
+
### Bugfix
|
212
|
+
|
213
|
+
* Return status code 0 when exists no auto-correctable cop ([#91](https://github.com/ryz310/rubocop_challenger/pull/91))
|
214
|
+
* Fix rubocop version mismatch ([#92](https://github.com/ryz310/rubocop_challenger/pull/92))
|
215
|
+
|
216
|
+
### Misc
|
217
|
+
|
218
|
+
* Style/RedundantSelf at Fri Oct 26 05:58:13 UTC 2018 ([#89](https://github.com/ryz310/rubocop_challenger/pull/89))
|
219
|
+
* Layout/SpaceInsideBlockBraces at Sat Oct 27 23:30:21 UTC 2018 ([#93](https://github.com/ryz310/rubocop_challenger/pull/93))
|
220
|
+
|
221
|
+
## v0.4.0 (Oct 26, 2018)
|
222
|
+
|
223
|
+
### Feature
|
224
|
+
|
225
|
+
* Generate document from yardoc ([#86](https://github.com/ryz310/rubocop_challenger/pull/86))
|
226
|
+
|
227
|
+
### Misc
|
228
|
+
|
229
|
+
* Rake/create pr for version up ([#81](https://github.com/ryz310/rubocop_challenger/pull/81))
|
230
|
+
* Style/RescueModifier at Wed Oct 24 23:30:21 UTC 2018 ([#82](https://github.com/ryz310/rubocop_challenger/pull/82))
|
231
|
+
|
232
|
+
## v0.3.1 (Oct 23, 2018)
|
233
|
+
|
234
|
+
### Feature
|
235
|
+
|
236
|
+
* Modify default template ([#73](https://github.com/ryz310/rubocop_challenger/pull/73))
|
237
|
+
|
238
|
+
|
239
|
+
## v0.3.0 (Oct 23, 2018)
|
240
|
+
|
241
|
+
### Feature
|
242
|
+
|
243
|
+
* Add labels option ([#67](https://github.com/ryz310/rubocop_challenger/pull/67))
|
244
|
+
* Add template option ([#70](https://github.com/ryz310/rubocop_challenger/pull/70))
|
245
|
+
|
246
|
+
### Misc
|
247
|
+
|
248
|
+
* Run rubocop challenge after release ([#68](https://github.com/ryz310/rubocop_challenger/pull/68))
|
249
|
+
|
250
|
+
## v0.2.1 (Oct 23, 2019)
|
251
|
+
|
252
|
+
### Bugfix
|
253
|
+
|
254
|
+
* Fix default PR template file path ([#64](https://github.com/ryz310/rubocop_challenger/pull/64))
|
255
|
+
|
256
|
+
## v0.2.0 (Oct 23, 2018)
|
257
|
+
|
258
|
+
### Feature
|
259
|
+
|
260
|
+
* Generate pr template ([#50](https://github.com/ryz310/rubocop_challenger/pull/50))
|
261
|
+
* Add no-commit option ([#53](https://github.com/ryz310/rubocop_challenger/pull/53))
|
262
|
+
* Return status code 1 when an error occurs ([#56](https://github.com/ryz310/rubocop_challenger/pull/56))
|
263
|
+
* Add option which regenerate rubocop todo file ([#59](https://github.com/ryz310/rubocop_challenger/pull/59))
|
264
|
+
|
265
|
+
### Misc
|
266
|
+
|
267
|
+
* Add access token description ([#48](https://github.com/ryz310/rubocop_challenger/pull/48))
|
268
|
+
* Add no document option to gem install command ([#51](https://github.com/ryz310/rubocop_challenger/pull/51))
|
269
|
+
|
270
|
+
## v0.1.3 (Oct 21, 2018)
|
271
|
+
|
272
|
+
### Misc
|
273
|
+
|
274
|
+
* Style/TrailingCommaInArrayLiteral at Fri Oct 19 23:30:18 UTC 2018 ([#34](https://github.com/ryz310/rubocop_challenger/pull/34))
|
275
|
+
* Update readme ([#36](https://github.com/ryz310/rubocop_challenger/pull/36))
|
276
|
+
* Add challenge class spec ([#42](https://github.com/ryz310/rubocop_challenger/pull/42))
|
277
|
+
|
278
|
+
## v0.1.2 (Oct 19, 2018)
|
279
|
+
|
280
|
+
### Misc
|
281
|
+
|
282
|
+
* Install from gem ([#28](https://github.com/ryz310/rubocop_challenger/pull/28))
|
283
|
+
|
284
|
+
## v0.1.1 (Oct 19, 2018)
|
285
|
+
|
286
|
+
Minor fixes
|
287
|
+
|
288
|
+
## v0.1.0 (Oct 18, 2018)
|
289
|
+
|
290
|
+
Initial release! :rocket:
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop_challenger (2.0.
|
5
|
-
pr_comet (~> 0.
|
4
|
+
rubocop_challenger (2.0.1)
|
5
|
+
pr_comet (~> 0.4.0)
|
6
6
|
rainbow
|
7
|
-
rubocop
|
7
|
+
rubocop (>= 0.87)
|
8
8
|
rubocop-performance
|
9
|
+
rubocop-rails
|
10
|
+
rubocop-rake
|
9
11
|
rubocop-rspec
|
10
12
|
thor
|
11
13
|
yard
|
@@ -13,86 +15,118 @@ PATH
|
|
13
15
|
GEM
|
14
16
|
remote: https://rubygems.org/
|
15
17
|
specs:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
activesupport (6.1.0)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (>= 1.6, < 2)
|
21
|
+
minitest (>= 5.1)
|
22
|
+
tzinfo (~> 2.0)
|
23
|
+
zeitwerk (~> 2.3)
|
24
|
+
addressable (2.7.0)
|
25
|
+
public_suffix (>= 2.0.2, < 5.0)
|
26
|
+
ast (2.4.1)
|
27
|
+
byebug (11.1.3)
|
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)
|
33
|
+
faraday-net_http (~> 1.0)
|
24
34
|
multipart-post (>= 1.2, < 3)
|
25
|
-
|
26
|
-
|
27
|
-
|
35
|
+
ruby2_keywords
|
36
|
+
faraday-net_http (1.0.0)
|
37
|
+
i18n (1.8.7)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
json (2.5.1)
|
40
|
+
method_source (1.0.0)
|
41
|
+
minitest (5.14.2)
|
28
42
|
multipart-post (2.1.1)
|
29
|
-
octokit (4.
|
43
|
+
octokit (4.20.0)
|
44
|
+
faraday (>= 0.9)
|
30
45
|
sawyer (~> 0.8.0, >= 0.5.3)
|
31
|
-
parallel (1.
|
32
|
-
parser (
|
33
|
-
ast (~> 2.4.
|
34
|
-
pr_comet (0.
|
46
|
+
parallel (1.20.1)
|
47
|
+
parser (3.0.0.0)
|
48
|
+
ast (~> 2.4.1)
|
49
|
+
pr_comet (0.4.0)
|
35
50
|
octokit
|
36
51
|
rainbow
|
37
|
-
pry (0.
|
38
|
-
coderay (~> 1.1
|
39
|
-
method_source (~>
|
40
|
-
pry-byebug (3.
|
52
|
+
pry (0.13.1)
|
53
|
+
coderay (~> 1.1)
|
54
|
+
method_source (~> 1.0)
|
55
|
+
pry-byebug (3.9.0)
|
41
56
|
byebug (~> 11.0)
|
42
|
-
pry (~> 0.
|
43
|
-
public_suffix (
|
57
|
+
pry (~> 0.13.0)
|
58
|
+
public_suffix (4.0.6)
|
59
|
+
rack (2.2.3)
|
44
60
|
rainbow (3.0.0)
|
45
|
-
rake (
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
rspec-
|
50
|
-
|
51
|
-
rspec-
|
52
|
-
rspec-
|
61
|
+
rake (13.0.3)
|
62
|
+
regexp_parser (2.0.3)
|
63
|
+
rexml (3.2.4)
|
64
|
+
rspec (3.10.0)
|
65
|
+
rspec-core (~> 3.10.0)
|
66
|
+
rspec-expectations (~> 3.10.0)
|
67
|
+
rspec-mocks (~> 3.10.0)
|
68
|
+
rspec-core (3.10.1)
|
69
|
+
rspec-support (~> 3.10.0)
|
70
|
+
rspec-expectations (3.10.1)
|
53
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-mocks (3.
|
72
|
+
rspec-support (~> 3.10.0)
|
73
|
+
rspec-mocks (3.10.1)
|
56
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
-
rspec-support (~> 3.
|
58
|
-
rspec-support (3.
|
75
|
+
rspec-support (~> 3.10.0)
|
76
|
+
rspec-support (3.10.1)
|
59
77
|
rspec_junit_formatter (0.4.1)
|
60
78
|
rspec-core (>= 2, < 4, != 2.12.0)
|
61
|
-
rubocop (
|
62
|
-
jaro_winkler (~> 1.5.1)
|
79
|
+
rubocop (1.7.0)
|
63
80
|
parallel (~> 1.10)
|
64
|
-
parser (>= 2.
|
81
|
+
parser (>= 2.7.1.5)
|
65
82
|
rainbow (>= 2.2.2, < 4.0)
|
83
|
+
regexp_parser (>= 1.8, < 3.0)
|
84
|
+
rexml
|
85
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
66
86
|
ruby-progressbar (~> 1.7)
|
67
|
-
unicode-display_width (>= 1.4.0, <
|
68
|
-
rubocop-
|
69
|
-
|
70
|
-
rubocop-
|
71
|
-
rubocop (>= 0.
|
72
|
-
|
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)
|
92
|
+
rubocop-ast (>= 0.4.0)
|
93
|
+
rubocop-rails (2.9.1)
|
94
|
+
activesupport (>= 4.2.0)
|
95
|
+
rack (>= 1.1)
|
96
|
+
rubocop (>= 0.90.0, < 2.0)
|
97
|
+
rubocop-rake (0.5.1)
|
98
|
+
rubocop
|
99
|
+
rubocop-rspec (2.1.0)
|
100
|
+
rubocop (~> 1.0)
|
101
|
+
rubocop-ast (>= 1.1.0)
|
102
|
+
ruby-progressbar (1.11.0)
|
103
|
+
ruby2_keywords (0.0.2)
|
73
104
|
sawyer (0.8.2)
|
74
105
|
addressable (>= 2.3.5)
|
75
106
|
faraday (> 0.8, < 2.0)
|
76
|
-
simplecov (0.17.
|
107
|
+
simplecov (0.17.1)
|
77
108
|
docile (~> 1.1)
|
78
109
|
json (>= 1.8, < 3)
|
79
110
|
simplecov-html (~> 0.10.0)
|
80
111
|
simplecov-html (0.10.2)
|
81
|
-
thor (0.
|
82
|
-
|
83
|
-
|
112
|
+
thor (1.0.1)
|
113
|
+
tzinfo (2.0.4)
|
114
|
+
concurrent-ruby (~> 1.0)
|
115
|
+
unicode-display_width (1.7.0)
|
116
|
+
yard (0.9.26)
|
117
|
+
zeitwerk (2.4.2)
|
84
118
|
|
85
119
|
PLATFORMS
|
86
120
|
ruby
|
87
121
|
|
88
122
|
DEPENDENCIES
|
89
|
-
bundler (
|
123
|
+
bundler (>= 2.0)
|
90
124
|
pry-byebug
|
91
|
-
rake (~>
|
125
|
+
rake (~> 13.0)
|
92
126
|
rspec
|
93
127
|
rspec_junit_formatter
|
94
128
|
rubocop_challenger!
|
95
|
-
simplecov
|
129
|
+
simplecov (= 0.17.1)
|
96
130
|
|
97
131
|
BUNDLED WITH
|
98
|
-
|
132
|
+
2.2.3
|
data/README.md
CHANGED
data/challenger.gemspec
CHANGED
@@ -22,18 +22,22 @@ 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.
|
25
|
+
spec.required_ruby_version = '>= 2.5'
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'pr_comet', '~> 0.4.0'
|
26
28
|
spec.add_runtime_dependency 'rainbow'
|
27
|
-
spec.add_runtime_dependency 'rubocop'
|
29
|
+
spec.add_runtime_dependency 'rubocop', '>= 0.87'
|
28
30
|
spec.add_runtime_dependency 'rubocop-performance'
|
31
|
+
spec.add_runtime_dependency 'rubocop-rails'
|
32
|
+
spec.add_runtime_dependency 'rubocop-rake'
|
29
33
|
spec.add_runtime_dependency 'rubocop-rspec'
|
30
34
|
spec.add_runtime_dependency 'thor'
|
31
35
|
spec.add_runtime_dependency 'yard'
|
32
36
|
|
33
|
-
spec.add_development_dependency 'bundler', '
|
37
|
+
spec.add_development_dependency 'bundler', '>= 2.0'
|
34
38
|
spec.add_development_dependency 'pry-byebug'
|
35
|
-
spec.add_development_dependency 'rake', '~>
|
39
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
36
40
|
spec.add_development_dependency 'rspec'
|
37
41
|
spec.add_development_dependency 'rspec_junit_formatter'
|
38
|
-
spec.add_development_dependency 'simplecov'
|
42
|
+
spec.add_development_dependency 'simplecov', '0.17.1'
|
39
43
|
end
|
data/lib/rubocop_challenger.rb
CHANGED
@@ -4,7 +4,6 @@ require 'erb'
|
|
4
4
|
require 'yard'
|
5
5
|
require 'rainbow'
|
6
6
|
require 'pr_comet'
|
7
|
-
require 'rubocop'
|
8
7
|
require 'rubocop_challenger/errors'
|
9
8
|
require 'rubocop_challenger/version'
|
10
9
|
require 'rubocop_challenger/rubocop/rule'
|
@@ -20,11 +19,12 @@ require 'rubocop_challenger/cli'
|
|
20
19
|
require 'rubocop_challenger/bundler/command'
|
21
20
|
require 'rubocop_challenger/github/pr_template'
|
22
21
|
|
23
|
-
|
24
|
-
%w[
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
module RubocopChallenger
|
23
|
+
RSPEC_GEMS = %w[
|
24
|
+
rubocop
|
25
|
+
rubocop-performance
|
26
|
+
rubocop-rails
|
27
|
+
rubocop-rake
|
28
|
+
rubocop-rspec
|
29
|
+
].freeze
|
30
30
|
end
|
@@ -10,7 +10,7 @@ module RubocopChallenger
|
|
10
10
|
#
|
11
11
|
# @param gem_names [Array<String>] The target gem names
|
12
12
|
def update(*gem_names)
|
13
|
-
run('update', *gem_names.select
|
13
|
+
run('update', *gem_names.select { |gem_name| installed?(gem_name) })
|
14
14
|
end
|
15
15
|
|
16
16
|
# Checks the gem is installed
|
@@ -61,6 +61,11 @@ module RubocopChallenger
|
|
61
61
|
type: :boolean,
|
62
62
|
default: true,
|
63
63
|
desc: 'Include the date and time when creating the .rubocop_todo.yml'
|
64
|
+
option :'only-safe-auto-correct',
|
65
|
+
type: :boolean,
|
66
|
+
default: false,
|
67
|
+
desc: 'If given `true`, it executes `rubocop --auto-correct`,' \
|
68
|
+
'it means to correct safe cops only.'
|
64
69
|
def go
|
65
70
|
Go.new(options).exec
|
66
71
|
rescue Errors::NoAutoCorrectableRule => e
|
@@ -4,28 +4,39 @@ module RubocopChallenger
|
|
4
4
|
module Github
|
5
5
|
# To generate Pull Request template as markdown
|
6
6
|
class PrTemplate
|
7
|
+
FOOTER_TEXT = 'Auto generated by [rubocop_challenger](https://github.com/ryz310/rubocop_challenger)'
|
8
|
+
|
7
9
|
def initialize(rule, template_path = nil)
|
8
10
|
template_path ||= default_template_path
|
9
11
|
@template = File.read(template_path)
|
10
12
|
@rule = rule
|
11
|
-
@yardoc = Rubocop::Yardoc.new(title)
|
12
13
|
end
|
13
14
|
|
14
15
|
def generate
|
15
16
|
<<~TEMPLATE
|
16
17
|
#{ERB.new(template, nil, '-').result(binding)}
|
17
|
-
|
18
|
+
#{FOOTER_TEXT}
|
19
|
+
TEMPLATE
|
20
|
+
rescue StandardError => e
|
21
|
+
error_template = File.read(error_template_path)
|
22
|
+
<<~TEMPLATE
|
23
|
+
#{ERB.new(error_template, nil, '-').result(binding)}
|
24
|
+
#{FOOTER_TEXT}
|
18
25
|
TEMPLATE
|
19
26
|
end
|
20
27
|
|
21
28
|
private
|
22
29
|
|
23
|
-
attr_reader :template, :rule
|
30
|
+
attr_reader :template, :rule
|
24
31
|
|
25
32
|
def default_template_path
|
26
33
|
File.expand_path('../../templates/default.md.erb', __dir__)
|
27
34
|
end
|
28
35
|
|
36
|
+
def error_template_path
|
37
|
+
File.expand_path('../../templates/error.md.erb', __dir__)
|
38
|
+
end
|
39
|
+
|
29
40
|
def title
|
30
41
|
rule.title
|
31
42
|
end
|
@@ -41,6 +52,10 @@ module RubocopChallenger
|
|
41
52
|
def examples
|
42
53
|
yardoc.examples
|
43
54
|
end
|
55
|
+
|
56
|
+
def yardoc
|
57
|
+
@yardoc ||= Rubocop::Yardoc.new(title)
|
58
|
+
end
|
44
59
|
end
|
45
60
|
end
|
46
61
|
end
|
@@ -9,6 +9,9 @@ module RubocopChallenger
|
|
9
9
|
# For how many exclude properties when creating the ".rubocop_todo.yml"
|
10
10
|
# @option auto-gen-timestamp [Boolean]
|
11
11
|
# Include the date and time when creating the ".rubocop_todo.yml"
|
12
|
+
# @option only-safe-auto-correct [Boolean]
|
13
|
+
# If given `true`, it executes `rubocop --auto-correct`,
|
14
|
+
# it means to correct safe cops only.
|
12
15
|
# @option name [String]
|
13
16
|
# The author name which use at the git commit
|
14
17
|
# @option email [String]
|
@@ -25,9 +28,6 @@ module RubocopChallenger
|
|
25
28
|
# multiple projects, you should supply this.
|
26
29
|
def initialize(options)
|
27
30
|
@options = options
|
28
|
-
@exclude_limit = options[:'exclude-limit']
|
29
|
-
@auto_gen_timestamp = options[:'auto-gen-timestamp']
|
30
|
-
@pull_request = PullRequest.new(extract_pull_request_options(options))
|
31
31
|
end
|
32
32
|
|
33
33
|
# Executes Rubocop Challenge flow
|
@@ -45,32 +45,17 @@ module RubocopChallenger
|
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
-
attr_reader :options
|
48
|
+
attr_reader :options
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
# @param options [Hash] The target options
|
53
|
-
# @return [Hash] Options for the PullRequest class
|
54
|
-
def extract_pull_request_options(options)
|
55
|
-
{
|
56
|
-
user_name: options[:name],
|
57
|
-
user_email: options[:email],
|
58
|
-
base_branch: options[:base_branch],
|
59
|
-
labels: options[:labels],
|
60
|
-
dry_run: options[:'no-create-pr'],
|
61
|
-
project_column_name: options[:project_column_name],
|
62
|
-
project_id: options[:project_id]
|
63
|
-
}
|
50
|
+
def pull_request
|
51
|
+
@pull_request ||= PullRequest.new(**pull_request_options)
|
64
52
|
end
|
65
53
|
|
66
54
|
# Executes `$ bundle update` for the rubocop and the associated gems
|
67
55
|
def update_rubocop!
|
68
56
|
bundler = Bundler::Command.new
|
69
57
|
pull_request.commit! ':police_car: $ bundle update rubocop' do
|
70
|
-
bundler.update
|
71
|
-
'rubocop-performance',
|
72
|
-
'rubocop-rails',
|
73
|
-
'rubocop-rspec'
|
58
|
+
bundler.update(*RSPEC_GEMS)
|
74
59
|
end
|
75
60
|
end
|
76
61
|
|
@@ -82,10 +67,7 @@ module RubocopChallenger
|
|
82
67
|
def regenerate_rubocop_todo!
|
83
68
|
before_version = scan_rubocop_version_in_rubocop_todo_file
|
84
69
|
pull_request.commit! ':police_car: regenerate rubocop todo' do
|
85
|
-
Rubocop::Command.new.auto_gen_config(
|
86
|
-
exclude_limit: exclude_limit,
|
87
|
-
auto_gen_timestamp: auto_gen_timestamp
|
88
|
-
)
|
70
|
+
Rubocop::Command.new.auto_gen_config(**auto_gen_config_options)
|
89
71
|
end
|
90
72
|
after_version = scan_rubocop_version_in_rubocop_todo_file
|
91
73
|
|
@@ -110,7 +92,7 @@ module RubocopChallenger
|
|
110
92
|
# @raise [Errors::NoAutoCorrectableRule]
|
111
93
|
# Raises if there is no auto correctable rule in ".rubocop_todo.yml"
|
112
94
|
def rubocop_challenge!(before_version, after_version)
|
113
|
-
Rubocop::Challenge.exec(
|
95
|
+
Rubocop::Challenge.exec(**rubocop_challenge_options).tap do |rule|
|
114
96
|
pull_request.commit! ":police_car: #{rule.title}"
|
115
97
|
end
|
116
98
|
rescue Errors::NoAutoCorrectableRule => e
|
@@ -174,5 +156,32 @@ module RubocopChallenger
|
|
174
156
|
todo_reader = Rubocop::TodoReader.new(options[:file_path])
|
175
157
|
todo_reader.all_rules.include?(rule)
|
176
158
|
end
|
159
|
+
|
160
|
+
def rubocop_challenge_options
|
161
|
+
{
|
162
|
+
file_path: options[:file_path],
|
163
|
+
mode: options[:mode],
|
164
|
+
only_safe_auto_correct: options[:'only-safe-auto-correct']
|
165
|
+
}
|
166
|
+
end
|
167
|
+
|
168
|
+
def pull_request_options
|
169
|
+
{
|
170
|
+
user_name: options[:name],
|
171
|
+
user_email: options[:email],
|
172
|
+
base_branch: options[:base_branch],
|
173
|
+
labels: options[:labels],
|
174
|
+
dry_run: options[:'no-create-pr'],
|
175
|
+
project_column_name: options[:project_column_name],
|
176
|
+
project_id: options[:project_id]
|
177
|
+
}
|
178
|
+
end
|
179
|
+
|
180
|
+
def auto_gen_config_options
|
181
|
+
{
|
182
|
+
exclude_limit: options[:'exclude-limit'],
|
183
|
+
auto_gen_timestamp: options[:'auto-gen-timestamp']
|
184
|
+
}
|
185
|
+
end
|
177
186
|
end
|
178
187
|
end
|
@@ -4,17 +4,18 @@ module RubocopChallenger
|
|
4
4
|
module Rubocop
|
5
5
|
# To execute Rubocop Challenge flow
|
6
6
|
class Challenge
|
7
|
-
def self.exec(file_path
|
8
|
-
new(file_path, mode).send(:exec)
|
7
|
+
def self.exec(file_path:, mode:, only_safe_auto_correct:)
|
8
|
+
new(file_path, mode, only_safe_auto_correct).send(:exec)
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
attr_reader :mode, :command, :todo_reader, :todo_writer
|
13
|
+
attr_reader :mode, :only_safe_auto_correct, :command, :todo_reader, :todo_writer
|
14
14
|
|
15
|
-
def initialize(file_path, mode)
|
15
|
+
def initialize(file_path, mode, only_safe_auto_correct)
|
16
16
|
@mode = mode
|
17
|
-
@
|
17
|
+
@only_safe_auto_correct = only_safe_auto_correct
|
18
|
+
@command = Rubocop::Command.new
|
18
19
|
@todo_reader = Rubocop::TodoReader.new(file_path)
|
19
20
|
@todo_writer = Rubocop::TodoWriter.new(file_path)
|
20
21
|
end
|
@@ -23,7 +24,7 @@ module RubocopChallenger
|
|
23
24
|
def exec
|
24
25
|
verify_target_rule
|
25
26
|
todo_writer.delete_rule(target_rule)
|
26
|
-
command.auto_correct
|
27
|
+
command.auto_correct(only_safe_auto_correct: only_safe_auto_correct)
|
27
28
|
target_rule
|
28
29
|
end
|
29
30
|
|
@@ -7,8 +7,12 @@ module RubocopChallenger
|
|
7
7
|
include PrComet::CommandLine
|
8
8
|
|
9
9
|
# Executes auto correction
|
10
|
-
def auto_correct
|
11
|
-
|
10
|
+
def auto_correct(only_safe_auto_correct:)
|
11
|
+
if only_safe_auto_correct
|
12
|
+
run('--auto-correct')
|
13
|
+
else
|
14
|
+
run('--auto-correct-all')
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
# Generates `.rubocop_todo.yml`
|
@@ -5,6 +5,7 @@ module RubocopChallenger
|
|
5
5
|
# To read YARD style documentation from rubocop gem source code
|
6
6
|
class Yardoc
|
7
7
|
def initialize(title)
|
8
|
+
load_rspec_gems!
|
8
9
|
@cop_class = find_cop_class(title)
|
9
10
|
YARD.parse(source_file_path)
|
10
11
|
@yardoc = YARD::Registry.all(:class).first
|
@@ -23,6 +24,15 @@ module RubocopChallenger
|
|
23
24
|
|
24
25
|
attr_reader :cop_class, :yardoc
|
25
26
|
|
27
|
+
# Loads gems for YARDoc creation
|
28
|
+
def load_rspec_gems!
|
29
|
+
RSPEC_GEMS.each do |dependency|
|
30
|
+
require dependency
|
31
|
+
rescue LoadError
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
26
36
|
# Find a RuboCop class by cop name. It find from rubocop/rspec if cannot
|
27
37
|
# find any class from rubocop gem.
|
28
38
|
#
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Rubocop challenge!
|
2
|
+
|
3
|
+
[<%= title %>](<%= rubydoc_url %>)
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
7
|
+
Sorry! Something went wrong! :bow:
|
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
|
+
|
10
|
+
```
|
11
|
+
title: <%= title %>
|
12
|
+
message: <%= e.message %>
|
13
|
+
|
14
|
+
---
|
15
|
+
<% e.backtrace.each do |line| -%>
|
16
|
+
<%= line %>
|
17
|
+
<% end -%>
|
18
|
+
```
|
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.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryosuke_sato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 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.
|
19
|
+
version: 0.4.0
|
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.
|
26
|
+
version: 0.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rainbow
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.87'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.87'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-performance
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -53,7 +67,21 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop-
|
70
|
+
name: rubocop-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - ">="
|
@@ -112,16 +140,16 @@ dependencies:
|
|
112
140
|
name: bundler
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
|
-
- - "
|
143
|
+
- - ">="
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
145
|
+
version: '2.0'
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
|
-
- - "
|
150
|
+
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
152
|
+
version: '2.0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: pry-byebug
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +170,14 @@ dependencies:
|
|
142
170
|
requirements:
|
143
171
|
- - "~>"
|
144
172
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
173
|
+
version: '13.0'
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
178
|
- - "~>"
|
151
179
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
180
|
+
version: '13.0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: rspec
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,16 +210,16 @@ dependencies:
|
|
182
210
|
name: simplecov
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
184
212
|
requirements:
|
185
|
-
- -
|
213
|
+
- - '='
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
215
|
+
version: 0.17.1
|
188
216
|
type: :development
|
189
217
|
prerelease: false
|
190
218
|
version_requirements: !ruby/object:Gem::Requirement
|
191
219
|
requirements:
|
192
|
-
- -
|
220
|
+
- - '='
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
222
|
+
version: 0.17.1
|
195
223
|
description: Make a clean your rubocop_todo.yml with CI
|
196
224
|
email:
|
197
225
|
- r-sato@feedforce.jp
|
@@ -201,11 +229,16 @@ extensions: []
|
|
201
229
|
extra_rdoc_files: []
|
202
230
|
files:
|
203
231
|
- ".circleci/config.yml"
|
232
|
+
- ".dependabot/config.yml"
|
204
233
|
- ".envrc.skeleton"
|
234
|
+
- ".gem_comet.yml"
|
235
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
205
236
|
- ".gitignore"
|
206
237
|
- ".rspec"
|
207
238
|
- ".rubocop.yml"
|
239
|
+
- ".rubocop_challenge.yml"
|
208
240
|
- ".rubocop_todo.yml"
|
241
|
+
- CHANGELOG.md
|
209
242
|
- CODE_OF_CONDUCT.md
|
210
243
|
- Gemfile
|
211
244
|
- Gemfile.lock
|
@@ -214,7 +247,6 @@ files:
|
|
214
247
|
- Rakefile
|
215
248
|
- bin/console
|
216
249
|
- bin/jailbreak
|
217
|
-
- bin/release
|
218
250
|
- bin/setup
|
219
251
|
- challenger.gemspec
|
220
252
|
- exe/rubocop_challenger
|
@@ -239,6 +271,7 @@ files:
|
|
239
271
|
- lib/rubocop_challenger/version.rb
|
240
272
|
- lib/templates/checklist.md.erb
|
241
273
|
- lib/templates/default.md.erb
|
274
|
+
- lib/templates/error.md.erb
|
242
275
|
- renovate.json
|
243
276
|
homepage: https://github.com/ryz310/rubocop_challenger
|
244
277
|
licenses:
|
@@ -252,14 +285,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
285
|
requirements:
|
253
286
|
- - ">="
|
254
287
|
- !ruby/object:Gem::Version
|
255
|
-
version: '
|
288
|
+
version: '2.5'
|
256
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
290
|
requirements:
|
258
|
-
- - "
|
291
|
+
- - ">="
|
259
292
|
- !ruby/object:Gem::Version
|
260
|
-
version:
|
293
|
+
version: '0'
|
261
294
|
requirements: []
|
262
|
-
rubygems_version: 3.
|
295
|
+
rubygems_version: 3.2.3
|
263
296
|
signing_key:
|
264
297
|
specification_version: 4
|
265
298
|
summary: Make a clean your rubocop_todo.yml with CI
|
data/bin/release
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# usage: bin/release VERSION
|
5
|
-
|
6
|
-
require 'bundler/setup'
|
7
|
-
require 'rubocop_challenger'
|
8
|
-
|
9
|
-
VERSION_FORMAT = /\A\d+\.\d+\.\d+(\.(pre|beta|rc)\d?)?\z/.freeze
|
10
|
-
version = ARGV[0]
|
11
|
-
rubocop = RubocopChallenger::Rubocop::Command.new
|
12
|
-
pr_comet = PrComet.new(base: 'master', branch: "update/v#{version}")
|
13
|
-
|
14
|
-
# Verifying
|
15
|
-
abort 'usage: bin/release VERSION' if version.nil?
|
16
|
-
abort 'A version must be like a `1.2.3`' unless version =~ VERSION_FORMAT
|
17
|
-
|
18
|
-
# Modify a version file
|
19
|
-
pr_comet.commit 'Update version' do
|
20
|
-
File.write('lib/rubocop_challenger/version.rb', <<~VERSION)
|
21
|
-
# frozen_string_literal: true
|
22
|
-
|
23
|
-
module RubocopChallenger
|
24
|
-
VERSION = '#{version}'
|
25
|
-
end
|
26
|
-
VERSION
|
27
|
-
end
|
28
|
-
|
29
|
-
# Bundle Update
|
30
|
-
pr_comet.commit 'Run $ bundle update' do
|
31
|
-
`bundle update`
|
32
|
-
end
|
33
|
-
|
34
|
-
# Regenerate .rubocop_todo.yml
|
35
|
-
pr_comet.commit 'Regenerate .rubocop_todo.yml' do
|
36
|
-
rubocop.auto_gen_config
|
37
|
-
end
|
38
|
-
|
39
|
-
# Create a pull request
|
40
|
-
pr_comet.create!(title: "Update v#{version}", body: '')
|