rubocop_challenger 2.8.0 → 2.10.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: '069b4741c020bd27b620bcf7e5cac220bd9f80de03735751598e148d7c622a0a'
4
- data.tar.gz: 0a9eedf4aed6d0154be1cd70f53ac4a573fcdc349b0be4611b60e8f3463f2c6f
3
+ metadata.gz: fd480b9644a15ff8dd4826189460791114badf59b888627bb1f2c0dd737c0d9e
4
+ data.tar.gz: 286460895c9301a0bb45a40cfcbc59ec93a7a7ee39bf7882027b013c2cf727e7
5
5
  SHA512:
6
- metadata.gz: 4b87dea0df5bbb1e54e9296d71752be6d5af85dc57374da52c34431175e831e103f2c45d565e22e0b6e6c5bc4e6bdca95761a849489984699f4aa4721c306f84
7
- data.tar.gz: 54357ce576a82ea8c950fc2d0ed1c21b956e04fc971659b05b3e62d43696850fb59394943ba30f761674f07462474037fdfb6ffb87780f2e5d33f588da37ea8a
6
+ metadata.gz: d5b660bee27fb1ecce41a518f2d500377b7ece212381d140af570bbc4466ed07cd636bdbabe84689066fdae11be1307dcc8c88801fb3461311ebb72adeac1de3
7
+ data.tar.gz: de601dc9b3e25f1bac75442cbeea4a7051e3326b68e2ed3232b3b72e584cecb60465d6c458ceed1ab321395765439f00cfdd0bbc7c28f2eec2c0c5ef087b4a13
data/.circleci/config.yml CHANGED
@@ -12,8 +12,8 @@ references:
12
12
  - &ruby_version
13
13
  ruby_version:
14
14
  type: enum
15
- enum: ["2.7", "3.0", "3.1"]
16
- default: "3.1"
15
+ enum: ["2.7", "3.0", "3.1", "3.2"]
16
+ default: "3.2"
17
17
 
18
18
  executors:
19
19
  default:
@@ -96,6 +96,7 @@ commands:
96
96
  - verify_rubocop_challenge
97
97
  - verify_rubocop_challenge
98
98
  - verify_rubocop_challenge
99
+ - rubocop
99
100
  rubocop_challenge:
100
101
  steps:
101
102
  - run:
@@ -159,7 +160,7 @@ jobs:
159
160
  - code-climate/install
160
161
  - code-climate/sum-coverage:
161
162
  input: codeclimate.*.json
162
- parts: 3
163
+ parts: 4
163
164
  - code-climate/upload-coverage
164
165
  rubocop:
165
166
  executor: default
@@ -201,6 +202,9 @@ workflows:
201
202
  - build:
202
203
  name: build_on_ruby_3.1
203
204
  ruby_version: "3.1"
205
+ - build:
206
+ name: build_on_ruby_3.2
207
+ ruby_version: "3.2"
204
208
  - rubocop
205
209
  - yardoc
206
210
  - integration_testing
@@ -209,12 +213,14 @@ workflows:
209
213
  - build_on_ruby_2.7
210
214
  - build_on_ruby_3.0
211
215
  - build_on_ruby_3.1
216
+ - build_on_ruby_3.2
212
217
  - release:
213
218
  context: RubyGems API Key
214
219
  requires:
215
220
  - build_on_ruby_2.7
216
221
  - build_on_ruby_3.0
217
222
  - build_on_ruby_3.1
223
+ - build_on_ruby_3.2
218
224
  - rubocop
219
225
  filters:
220
226
  branches:
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.30.0.
3
+ # using RuboCop version 1.41.1.
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,15 +1,50 @@
1
1
  # Change log
2
2
 
3
+ ## v2.10.0 (Feb 12, 2023)
4
+
5
+ ### Feature
6
+
7
+ - [#688](https://github.com/ryz310/rubocop_challenger/pull/688) Support ruby 3.2 ([@ryz310](https://github.com/ryz310))
8
+
9
+ ### Bugfix
10
+
11
+ - [#686](https://github.com/ryz310/rubocop_challenger/pull/686) Skip bundle update if gems not related to rubocop ([@ryz310](https://github.com/ryz310))
12
+ - [#687](https://github.com/ryz310/rubocop_challenger/pull/687) Fix the cop class loader ([@ryz310](https://github.com/ryz310))
13
+
14
+ ### Rubocop Challenge
15
+
16
+ - [#683](https://github.com/ryz310/rubocop_challenger/pull/683) Re-generate .rubocop_todo.yml with RuboCop v1.41.1 ([@ryz310](https://github.com/ryz310))
17
+
18
+ ### Dependabot
19
+
20
+ - [#644](https://github.com/ryz310/rubocop_challenger/pull/644) Update pr_comet requirement from >= 0.5.1, < 0.7.0 to >= 0.5.1, < 0.8.0 ([@ryz310](https://github.com/ryz310))
21
+ - [#649](https://github.com/ryz310/rubocop_challenger/pull/649) Bump pry-byebug from 3.10.0 to 3.10.1 ([@ryz310](https://github.com/ryz310))
22
+ - [#657](https://github.com/ryz310/rubocop_challenger/pull/657) Bump rspec_junit_formatter from 0.5.1 to 0.6.0 ([@ryz310](https://github.com/ryz310))
23
+ - [#660](https://github.com/ryz310/rubocop_challenger/pull/660) Bump rspec from 3.11.0 to 3.12.0 ([@ryz310](https://github.com/ryz310))
24
+ - [#665](https://github.com/ryz310/rubocop_challenger/pull/665) Bump rubocop-performance from 1.15.0 to 1.15.1 ([@ryz310](https://github.com/ryz310))
25
+ - [#666](https://github.com/ryz310/rubocop_challenger/pull/666) ryz310/dependabot/bundler/rubocop-rails-2.17.3 ([@ryz310](https://github.com/ryz310))
26
+ - [#674](https://github.com/ryz310/rubocop_challenger/pull/674) Update simplecov requirement from = 0.21.2 to = 0.22.0 ([@ryz310](https://github.com/ryz310))
27
+
28
+ ## v2.9.0 (Jun 02, 2022)
29
+
30
+ ### Feature
31
+
32
+ - [#628](https://github.com/ryz310/rubocop_challenger/pull/628) Change `auto-correct` to `autocorrect` ([@ryz310](https://github.com/ryz310))
33
+
34
+ ### Dependabot
35
+
36
+ - [#629](https://github.com/ryz310/rubocop_challenger/pull/629) Bump yard from 0.9.27 to 0.9.28 ([@ryz310](https://github.com/ryz310))
37
+
3
38
  ## v2.8.0 (May 30, 2022)
4
39
 
5
40
  ### Feature
6
41
 
7
42
  - [#616](https://github.com/ryz310/rubocop_challenger/pull/616) Support `--no-offense-counts` option ([@ryz310](https://github.com/ryz310))
43
+ - [#625](https://github.com/ryz310/rubocop_challenger/pull/625) Use `--conservative` option on `bundle update` ([@ryz310](https://github.com/ryz310))
8
44
 
9
45
  ### Bugfix
10
46
 
11
47
  - [#612](https://github.com/ryz310/rubocop_challenger/pull/612) Fix wrong usage of `Array#reject!`: this might return nil ([@r7kamura](https://github.com/r7kamura))
12
- - [#625](https://github.com/ryz310/rubocop_challenger/pull/625) Use `--conservative` option on `bundle update` ([@ryz310](https://github.com/ryz310))
13
48
 
14
49
  ### Breaking Change
15
50
 
data/Gemfile CHANGED
@@ -6,3 +6,13 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in rubocop_challenger.gemspec
8
8
  gemspec
9
+
10
+ gem 'pry-byebug'
11
+ gem 'rspec'
12
+ gem 'rspec_junit_formatter'
13
+ gem 'rubocop', '>= 0.87'
14
+ gem 'rubocop-performance'
15
+ gem 'rubocop-rails'
16
+ gem 'rubocop-rake'
17
+ gem 'rubocop-rspec'
18
+ gem 'rubocop-thread_safety'
data/Gemfile.lock CHANGED
@@ -1,119 +1,118 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_challenger (2.8.0)
5
- pr_comet (>= 0.5.1, < 0.7.0)
4
+ rubocop_challenger (2.10.0)
5
+ pr_comet (>= 0.5.1, < 0.8.0)
6
6
  rainbow
7
- rubocop (>= 0.87)
8
- rubocop-performance
9
- rubocop-rails
10
- rubocop-rake
11
- rubocop-rspec
12
- rubocop-thread_safety
13
7
  thor
14
8
  yard
15
9
 
16
10
  GEM
17
11
  remote: https://rubygems.org/
18
12
  specs:
19
- activesupport (7.0.3)
13
+ activesupport (7.0.4.2)
20
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
15
  i18n (>= 1.6, < 2)
22
16
  minitest (>= 5.1)
23
17
  tzinfo (~> 2.0)
24
- addressable (2.8.0)
25
- public_suffix (>= 2.0.2, < 5.0)
18
+ addressable (2.8.1)
19
+ public_suffix (>= 2.0.2, < 6.0)
26
20
  ast (2.4.2)
27
21
  byebug (11.1.3)
28
22
  coderay (1.1.3)
29
- concurrent-ruby (1.1.10)
23
+ concurrent-ruby (1.2.0)
30
24
  diff-lcs (1.5.0)
31
25
  docile (1.4.0)
32
- faraday (2.3.0)
33
- faraday-net_http (~> 2.0)
26
+ faraday (2.7.4)
27
+ faraday-net_http (>= 2.0, < 3.1)
34
28
  ruby2_keywords (>= 0.0.4)
35
- faraday-net_http (2.0.3)
36
- i18n (1.10.0)
29
+ faraday-net_http (3.0.2)
30
+ i18n (1.12.0)
37
31
  concurrent-ruby (~> 1.0)
32
+ json (2.6.3)
38
33
  method_source (1.0.0)
39
- minitest (5.15.0)
40
- octokit (4.23.0)
34
+ minitest (5.17.0)
35
+ octokit (6.0.1)
41
36
  faraday (>= 1, < 3)
42
37
  sawyer (~> 0.9)
43
38
  parallel (1.22.1)
44
- parser (3.1.2.0)
39
+ parser (3.2.1.0)
45
40
  ast (~> 2.4.1)
46
- pr_comet (0.6.0)
41
+ pr_comet (0.7.0)
47
42
  octokit
48
43
  rainbow
49
- pry (0.13.1)
44
+ pry (0.14.2)
50
45
  coderay (~> 1.1)
51
46
  method_source (~> 1.0)
52
- pry-byebug (3.9.0)
47
+ pry-byebug (3.10.1)
53
48
  byebug (~> 11.0)
54
- pry (~> 0.13.0)
55
- public_suffix (4.0.7)
56
- rack (2.2.3.1)
49
+ pry (>= 0.13, < 0.15)
50
+ public_suffix (5.0.1)
51
+ rack (3.0.4.1)
57
52
  rainbow (3.1.1)
58
53
  rake (13.0.6)
59
- regexp_parser (2.5.0)
54
+ regexp_parser (2.7.0)
60
55
  rexml (3.2.5)
61
- rspec (3.11.0)
62
- rspec-core (~> 3.11.0)
63
- rspec-expectations (~> 3.11.0)
64
- rspec-mocks (~> 3.11.0)
65
- rspec-core (3.11.0)
66
- rspec-support (~> 3.11.0)
67
- rspec-expectations (3.11.0)
56
+ rspec (3.12.0)
57
+ rspec-core (~> 3.12.0)
58
+ rspec-expectations (~> 3.12.0)
59
+ rspec-mocks (~> 3.12.0)
60
+ rspec-core (3.12.1)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-expectations (3.12.2)
68
63
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.11.0)
70
- rspec-mocks (3.11.1)
64
+ rspec-support (~> 3.12.0)
65
+ rspec-mocks (3.12.3)
71
66
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.11.0)
73
- rspec-support (3.11.0)
74
- rspec_junit_formatter (0.5.1)
67
+ rspec-support (~> 3.12.0)
68
+ rspec-support (3.12.0)
69
+ rspec_junit_formatter (0.6.0)
75
70
  rspec-core (>= 2, < 4, != 2.12.0)
76
- rubocop (1.30.0)
71
+ rubocop (1.45.1)
72
+ json (~> 2.3)
77
73
  parallel (~> 1.10)
78
- parser (>= 3.1.0.0)
74
+ parser (>= 3.2.0.0)
79
75
  rainbow (>= 2.2.2, < 4.0)
80
76
  regexp_parser (>= 1.8, < 3.0)
81
77
  rexml (>= 3.2.5, < 4.0)
82
- rubocop-ast (>= 1.18.0, < 2.0)
78
+ rubocop-ast (>= 1.24.1, < 2.0)
83
79
  ruby-progressbar (~> 1.7)
84
- unicode-display_width (>= 1.4.0, < 3.0)
85
- rubocop-ast (1.18.0)
86
- parser (>= 3.1.1.0)
87
- rubocop-performance (1.14.0)
80
+ unicode-display_width (>= 2.4.0, < 3.0)
81
+ rubocop-ast (1.26.0)
82
+ parser (>= 3.2.1.0)
83
+ rubocop-capybara (2.17.0)
84
+ rubocop (~> 1.41)
85
+ rubocop-performance (1.16.0)
88
86
  rubocop (>= 1.7.0, < 2.0)
89
87
  rubocop-ast (>= 0.4.0)
90
- rubocop-rails (2.14.2)
88
+ rubocop-rails (2.17.4)
91
89
  activesupport (>= 4.2.0)
92
90
  rack (>= 1.1)
93
- rubocop (>= 1.7.0, < 2.0)
91
+ rubocop (>= 1.33.0, < 2.0)
94
92
  rubocop-rake (0.6.0)
95
93
  rubocop (~> 1.0)
96
- rubocop-rspec (2.11.1)
97
- rubocop (~> 1.19)
94
+ rubocop-rspec (2.18.1)
95
+ rubocop (~> 1.33)
96
+ rubocop-capybara (~> 2.17)
98
97
  rubocop-thread_safety (0.4.4)
99
98
  rubocop (>= 0.53.0)
100
99
  ruby-progressbar (1.11.0)
101
100
  ruby2_keywords (0.0.5)
102
- sawyer (0.9.1)
101
+ sawyer (0.9.2)
103
102
  addressable (>= 2.3.5)
104
103
  faraday (>= 0.17.3, < 3)
105
- simplecov (0.21.2)
104
+ simplecov (0.22.0)
106
105
  docile (~> 1.1)
107
106
  simplecov-html (~> 0.11)
108
107
  simplecov_json_formatter (~> 0.1)
109
108
  simplecov-html (0.12.3)
110
109
  simplecov_json_formatter (0.1.4)
111
110
  thor (1.2.1)
112
- tzinfo (2.0.4)
111
+ tzinfo (2.0.6)
113
112
  concurrent-ruby (~> 1.0)
114
- unicode-display_width (2.1.0)
113
+ unicode-display_width (2.4.2)
115
114
  webrick (1.7.0)
116
- yard (0.9.27)
115
+ yard (0.9.28)
117
116
  webrick (~> 1.7.0)
118
117
 
119
118
  PLATFORMS
@@ -125,8 +124,14 @@ DEPENDENCIES
125
124
  rake (~> 13.0)
126
125
  rspec
127
126
  rspec_junit_formatter
127
+ rubocop (>= 0.87)
128
+ rubocop-performance
129
+ rubocop-rails
130
+ rubocop-rake
131
+ rubocop-rspec
132
+ rubocop-thread_safety
128
133
  rubocop_challenger!
129
- simplecov (= 0.21.2)
134
+ simplecov (= 0.22.0)
130
135
 
131
136
  BUNDLED WITH
132
137
  2.2.32
data/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  [![CircleCI](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master.svg?style=svg&circle-token=cdf0ffce5b4c0c7804b50dde00ca5ef09cbadb67)](https://circleci.com/gh/ryz310/rubocop_challenger/tree/master) [![Gem Version](https://badge.fury.io/rb/rubocop_challenger.svg)](https://badge.fury.io/rb/rubocop_challenger) [![Maintainability](https://api.codeclimate.com/v1/badges/a18c1c17fc534bb32473/maintainability)](https://codeclimate.com/github/ryz310/rubocop_challenger/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/a18c1c17fc534bb32473/test_coverage)](https://codeclimate.com/github/ryz310/rubocop_challenger/test_coverage)
4
4
 
5
5
  If you introduce [`rubocop`](https://github.com/rubocop-hq/rubocop) to an existing Rails project later, you will use [`$ rubocop --auto-gen-config`](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#automatically-generated-configuration). But it will make a huge `.rubocop_todo.yml` and make you despair.
6
- On the other hand, `rubocop` has [`--auto-correct`](https://github.com/rubocop-hq/rubocop/blob/master/manual/basic_usage.md#other-useful-command-line-flags) option, it is possible to automatically repair the writing which does not conform to the rule. But since it occasionally destroys your code, it is quite dangerous to apply all at once.
6
+ On the other hand, `rubocop` has [`--autocorrect`](https://github.com/rubocop-hq/rubocop/blob/master/manual/basic_usage.md#other-useful-command-line-flags) option, it is possible to automatically repair the writing which does not conform to the rule. But since it occasionally destroys your code, it is quite dangerous to apply all at once.
7
7
  It is ideal that to remove a disabled rule from `.rubocop_todo.yml` every day, to check whether it passes test, and can be obtained consent from the team. But it requires strong persistence and time.
8
8
  I call such work _Rubocop Challenge_. And the _RubocopChallenger_ is a gem to support this challenge!
9
9
 
10
10
  ## The history of RubocopChallenger with decrease of offense codes
11
11
 
12
- The following chart shows the history of RubocopChallenger and decrease of offense codes at a `.rubocop_todo.yml`. The project was released at 5 years ago, and then it was introduced the RuboCop gem for huge source code including a lots of offense codes. Before using the RubocopChallenger, it was not maintain to reduce offense codes. One day, I felt a crisis and started maintain with manual. I made a lots of Pull Requests to reduce them but it's a load for me and reviewers. So I created a script for automation the flow, which is the predecessor of Rubocop Challenger gem. It brought reducing the offense codes continuously. After 8 months, finally it has done. There is no auto-correctable offense codes.
13
- But there are many offenses which is un-auto-correctable yet. I will try to reduce it with the RubocopChallenger. The RubocopChallenger will
12
+ The following chart shows the history of RubocopChallenger and decrease of offense codes at a `.rubocop_todo.yml`. The project was released at 5 years ago, and then it was introduced the RuboCop gem for huge source code including a lots of offense codes. Before using the RubocopChallenger, it was not maintain to reduce offense codes. One day, I felt a crisis and started maintain with manual. I made a lots of Pull Requests to reduce them but it's a load for me and reviewers. So I created a script for automation the flow, which is the predecessor of Rubocop Challenger gem. It brought reducing the offense codes continuously. After 8 months, finally it has done. There is no autocorrectable offense codes.
13
+ But there are many offenses which is un-autocorrectable yet. I will try to reduce it with the RubocopChallenger. The RubocopChallenger will
14
14
  be continued to evolve.
15
15
 
16
16
  ![Decrease of offense codes](images/decrease_of_offense_codes.png)
@@ -18,7 +18,7 @@ be continued to evolve.
18
18
  ## Rubocop Challenge Flow
19
19
 
20
20
  1. Run _RubocopChallenger_ periodically from CI tool etc.
21
- 1. When _RubocopChallenger_ starts, delete a disabled rule from `.rubocop_todo.yml` existing in your project, execute `$ rubocop --auto-correct` and create a PR which include modified results
21
+ 1. When _RubocopChallenger_ starts, delete a disabled rule from `.rubocop_todo.yml` existing in your project, execute `$ rubocop --autocorrect` and create a PR which include modified results
22
22
  1. You confirm the PR passes testing and then merge it if there is no problem
23
23
 
24
24
  [![Rubocop Challenge](images/rubocop_challenge.png)](https://github.com/ryz310/rubocop_challenger/pull/97)
@@ -88,7 +88,7 @@ See: [RuboCop Challenger を GitHub Actions で動かす](https://zenn.dev/yamat
88
88
  $ rubocop_challenger help
89
89
 
90
90
  Commands:
91
- rubocop_challenger go --email=EMAIL --name=NAME # Run `$ rubocop --auto-correct` and create a PR to GitHub repo
91
+ rubocop_challenger go --email=EMAIL --name=NAME # Run `$ rubocop --autocorrect` and create a PR to GitHub repo
92
92
  rubocop_challenger help [COMMAND] # Describe available commands or one specific command
93
93
  rubocop_challenger version # Show current version
94
94
  ```
@@ -122,10 +122,10 @@ Options:
122
122
  # Default: true
123
123
  [--offense-counts], [--no-offense-counts] # Include offense counts in .rubocop_todo.yml
124
124
  # Default: true
125
- [--only-safe-auto-correct], [--no-only-safe-auto-correct] # If given `true`, it executes `rubocop --auto-correct`,it means to correct safe cops only.
125
+ [--only-safe-autocorrect], [--no-only-safe-autocorrect] # If given `true`, it executes `rubocop --autocorrect`,it means to correct safe cops only.
126
126
  [--verbose], [--no-verbose] # Displays executing command.
127
127
 
128
- Run `$ rubocop --auto-correct` and create a PR to GitHub repo
128
+ Run `$ rubocop --autocorrect` and create a PR to GitHub repo
129
129
  ```
130
130
 
131
131
  ## Requirement
data/challenger.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'rubocop_challenger'
9
9
  spec.version = RubocopChallenger::VERSION
10
10
  spec.authors = ['ryosuke_sato']
11
- spec.email = ['r-sato@feedforce.jp']
11
+ spec.email = ['ryz310@gmail.com']
12
12
 
13
13
  spec.summary = 'Make a clean your rubocop_todo.yml with CI'
14
14
  spec.description = spec.summary
@@ -24,23 +24,14 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = '>= 2.7'
26
26
 
27
- spec.add_runtime_dependency 'pr_comet', '>= 0.5.1', '< 0.7.0'
27
+ spec.add_runtime_dependency 'pr_comet', '>= 0.5.1', '< 0.8.0'
28
28
  spec.add_runtime_dependency 'rainbow'
29
- spec.add_runtime_dependency 'rubocop', '>= 0.87'
30
- spec.add_runtime_dependency 'rubocop-performance'
31
- spec.add_runtime_dependency 'rubocop-rails'
32
- spec.add_runtime_dependency 'rubocop-rake'
33
- spec.add_runtime_dependency 'rubocop-rspec'
34
- spec.add_runtime_dependency 'rubocop-thread_safety'
35
29
  spec.add_runtime_dependency 'thor'
36
30
  spec.add_runtime_dependency 'yard'
37
31
 
38
32
  spec.add_development_dependency 'bundler', '>= 2.0'
39
- spec.add_development_dependency 'pry-byebug'
40
33
  spec.add_development_dependency 'rake', '~> 13.0'
41
- spec.add_development_dependency 'rspec'
42
- spec.add_development_dependency 'rspec_junit_formatter'
43
- spec.add_development_dependency 'simplecov', '0.21.2'
34
+ spec.add_development_dependency 'simplecov', '0.22.0'
44
35
  spec.metadata = {
45
36
  'rubygems_mfa_required' => 'true'
46
37
  }
@@ -14,7 +14,10 @@ module RubocopChallenger
14
14
  #
15
15
  # @param gem_names [Array<String>] The target gem names
16
16
  def update(*gem_names)
17
- run('update', *gem_names.select { |gem_name| installed?(gem_name) }, '--conservative')
17
+ target_gems = gem_names.select { |gem_name| installed?(gem_name) }
18
+ return if target_gems.empty?
19
+
20
+ run('update', *target_gems, '--conservative')
18
21
  end
19
22
 
20
23
  # Checks the gem is installed
@@ -5,7 +5,7 @@ require 'thor'
5
5
  module RubocopChallenger
6
6
  # To define CLI commands
7
7
  class CLI < Thor
8
- desc 'go', 'Run `$ rubocop --auto-correct` and create a PR to GitHub repo'
8
+ desc 'go', 'Run `$ rubocop --autocorrect` and create a PR to GitHub repo'
9
9
  option :email,
10
10
  required: true,
11
11
  type: :string,
@@ -65,10 +65,10 @@ module RubocopChallenger
65
65
  type: :boolean,
66
66
  default: true,
67
67
  desc: 'Include offense counts in .rubocop_todo.yml'
68
- option :only_safe_auto_correct,
68
+ option :only_safe_autocorrect,
69
69
  type: :boolean,
70
70
  default: false,
71
- desc: 'If given `true`, it executes `rubocop --auto-correct`,' \
71
+ desc: 'If given `true`, it executes `rubocop --autocorrect`,' \
72
72
  'it means to correct safe cops only.'
73
73
  option :verbose,
74
74
  type: :boolean,
@@ -2,10 +2,10 @@
2
2
 
3
3
  module RubocopChallenger
4
4
  module Errors
5
- # Raise if no auto-correctable rule in the `.rubocop_todo.yml`.
5
+ # Raise if no autocorrectable rule in the `.rubocop_todo.yml`.
6
6
  class NoAutoCorrectableRule < StandardError
7
7
  def initialize
8
- super 'There is no auto-correctable rule'
8
+ super 'There is no autocorrectable rule'
9
9
  end
10
10
  end
11
11
  end
@@ -11,8 +11,8 @@ module RubocopChallenger
11
11
  # Include the date and time in .rubocop_todo.yml
12
12
  # @option offense_counts [Boolean]
13
13
  # Include offense counts in .rubocop_todo.yml'
14
- # @option only-safe-auto-correct [Boolean]
15
- # If given `true`, it executes `rubocop --auto-correct`,
14
+ # @option only-safe-autocorrect [Boolean]
15
+ # If given `true`, it executes `rubocop --autocorrect`,
16
16
  # it means to correct safe cops only.
17
17
  # @option name [String]
18
18
  # The author name which use at the git commit
@@ -59,7 +59,7 @@ module RubocopChallenger
59
59
  def update_rubocop!
60
60
  bundler = Bundler::Command.new(verbose: options[:verbose])
61
61
  pull_request.commit! ':police_car: $ bundle update rubocop' do
62
- bundler.update(*RSPEC_GEMS)
62
+ bundler.update(*RUBOCOP_GEMS)
63
63
  end
64
64
  end
65
65
 
@@ -131,7 +131,7 @@ module RubocopChallenger
131
131
  end
132
132
 
133
133
  DESCRIPTION_THAT_CHALLENGE_IS_INCOMPLETE = <<~MSG
134
- Rubocop Challenger has executed auto-correcting but it is incomplete.
134
+ Rubocop Challenger has executed autocorrecting but it is incomplete.
135
135
  Therefore the rule add to ignore list.
136
136
  MSG
137
137
 
@@ -141,7 +141,7 @@ module RubocopChallenger
141
141
  #
142
142
  # @param rule [Rubocop::Rule] The corrected rule
143
143
  def add_to_ignore_list_if_challenge_is_incomplete(rule)
144
- return unless auto_correct_incomplete?(rule)
144
+ return unless autocorrect_incomplete?(rule)
145
145
 
146
146
  pull_request.commit! ':police_car: add the rule to the ignore list' do
147
147
  config_editor = Rubocop::ConfigEditor.new
@@ -156,7 +156,7 @@ module RubocopChallenger
156
156
  #
157
157
  # @param rule [Rubocop::Rule] The corrected rule
158
158
  # @return [Boolean] Return true if the challenge successed
159
- def auto_correct_incomplete?(rule)
159
+ def autocorrect_incomplete?(rule)
160
160
  todo_reader = Rubocop::TodoReader.new(options[:file_path])
161
161
  todo_reader.all_rules.include?(rule)
162
162
  end
@@ -165,7 +165,7 @@ module RubocopChallenger
165
165
  {
166
166
  file_path: options[:file_path],
167
167
  mode: mode,
168
- only_safe_auto_correct: options[:only_safe_auto_correct]
168
+ only_safe_autocorrect: options[:only_safe_autocorrect]
169
169
  }
170
170
  end
171
171
 
@@ -4,17 +4,17 @@ module RubocopChallenger
4
4
  module Rubocop
5
5
  # To execute Rubocop Challenge flow
6
6
  class Challenge
7
- def self.exec(file_path:, mode:, only_safe_auto_correct:)
8
- new(file_path, mode, only_safe_auto_correct).send(:exec)
7
+ def self.exec(file_path:, mode:, only_safe_autocorrect:)
8
+ new(file_path, mode, only_safe_autocorrect).send(:exec)
9
9
  end
10
10
 
11
11
  private
12
12
 
13
- attr_reader :mode, :only_safe_auto_correct, :command, :todo_reader, :todo_writer
13
+ attr_reader :mode, :only_safe_autocorrect, :command, :todo_reader, :todo_writer
14
14
 
15
- def initialize(file_path, mode, only_safe_auto_correct)
15
+ def initialize(file_path, mode, only_safe_autocorrect)
16
16
  @mode = mode
17
- @only_safe_auto_correct = only_safe_auto_correct
17
+ @only_safe_autocorrect = only_safe_autocorrect
18
18
  @command = Rubocop::Command.new
19
19
  @todo_reader = Rubocop::TodoReader.new(file_path)
20
20
  @todo_writer = Rubocop::TodoWriter.new(file_path)
@@ -24,7 +24,7 @@ module RubocopChallenger
24
24
  def exec
25
25
  verify_target_rule
26
26
  todo_writer.delete_rule(target_rule)
27
- command.auto_correct(only_safe_auto_correct: only_safe_auto_correct)
27
+ command.autocorrect(only_safe_autocorrect: only_safe_autocorrect)
28
28
  target_rule
29
29
  end
30
30
 
@@ -7,11 +7,11 @@ module RubocopChallenger
7
7
  include PrComet::CommandLine
8
8
 
9
9
  # Executes auto correction
10
- def auto_correct(only_safe_auto_correct:)
11
- if only_safe_auto_correct
12
- run('--auto-correct')
10
+ def autocorrect(only_safe_autocorrect:)
11
+ if only_safe_autocorrect
12
+ run('-a') # --autocorrect Autocorrect offenses (only when it's safe).
13
13
  else
14
- run('--auto-correct-all')
14
+ run('-A') # --autocorrect-all Autocorrect offenses (safe and unsafe).
15
15
  end
16
16
  end
17
17
 
@@ -26,9 +26,10 @@ module RubocopChallenger
26
26
  offense_count <=> other.offense_count
27
27
  end
28
28
 
29
- def auto_correctable?
30
- contents.include?('# Cop supports --auto-correct') || # for rubocop < v1.26.0
31
- contents.match?(/# This cop supports (un)?safe auto-correction/) # for rubocop >= v1.26.0
29
+ def autocorrectable?
30
+ contents.match?('# This cop supports (un)?safe autocorrection') || # for rubocop >= v1.30.0
31
+ contents.match?(/# This cop supports (un)?safe auto-correction/) || # for rubocop >= v1.26.0
32
+ contents.include?('# Cop supports --auto-correct') # for rubocop < v1.26.0
32
33
  end
33
34
 
34
35
  def rubydoc_url
@@ -29,23 +29,23 @@ module RubocopChallenger
29
29
  end
30
30
 
31
31
  # @return [Array<Rule>]
32
- def auto_correctable_rules
33
- all_rules.select(&:auto_correctable?)
32
+ def autocorrectable_rules
33
+ all_rules.select(&:autocorrectable?)
34
34
  end
35
35
 
36
36
  # @return [Rule]
37
37
  def least_occurrence_rule
38
- auto_correctable_rules.first
38
+ autocorrectable_rules.first
39
39
  end
40
40
 
41
41
  # @return [Rule]
42
42
  def most_occurrence_rule
43
- auto_correctable_rules.last
43
+ autocorrectable_rules.last
44
44
  end
45
45
 
46
46
  # @return [Rule]
47
47
  def any_rule
48
- auto_correctable_rules.sample
48
+ autocorrectable_rules.sample
49
49
  end
50
50
 
51
51
  private
@@ -5,7 +5,7 @@ module RubocopChallenger
5
5
  # To read YARD style documentation from rubocop gem source code
6
6
  class Yardoc
7
7
  def initialize(cop)
8
- load_rspec_gems!
8
+ load_rubocop_gems!
9
9
  @cop_class = find_cop_class(cop)
10
10
  load_yardoc!
11
11
  end
@@ -18,8 +18,8 @@ module RubocopChallenger
18
18
  yardoc.tags('example').map { |tag| [tag.name, tag.text] }
19
19
  end
20
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.
21
+ # Indicates whether the autocorrect a cop does is safe (equivalent) by design.
22
+ # If a cop is unsafe its autocorrect automatically becomes unsafe as well.
23
23
  #
24
24
  # @return [Boolean]
25
25
  def safe_autocorrect?
@@ -32,8 +32,8 @@ module RubocopChallenger
32
32
  attr_reader :cop_class, :yardoc
33
33
 
34
34
  # Loads gems for YARDoc creation
35
- def load_rspec_gems!
36
- RSPEC_GEMS.each do |dependency|
35
+ def load_rubocop_gems!
36
+ RUBOCOP_GEMS.each do |dependency|
37
37
  require dependency
38
38
  rescue LoadError
39
39
  nil
@@ -46,9 +46,9 @@ module RubocopChallenger
46
46
  # @param cop [String] The target cop name (e.g. "Performance/Size")
47
47
  # @return [RuboCop::Cop] Found a RuboCop::Cop class
48
48
  def find_cop_class(cop)
49
- Object.const_get("RuboCop::Cop::#{cop.sub('/', '::')}")
49
+ Object.const_get("RuboCop::Cop::#{cop.gsub('/', '::')}")
50
50
  rescue NameError
51
- Object.const_get("RuboCop::Cop::RSpec::#{cop.sub('/', '::')}")
51
+ Object.const_get("RuboCop::Cop::RSpec::#{cop.gsub('/', '::')}")
52
52
  end
53
53
 
54
54
  # Loads yardoc from the RuboCop::Cop class file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopChallenger
4
- VERSION = '2.8.0'
4
+ VERSION = '2.10.0'
5
5
  end
@@ -20,7 +20,7 @@ require 'rubocop_challenger/bundler/command'
20
20
  require 'rubocop_challenger/github/pr_template'
21
21
 
22
22
  module RubocopChallenger
23
- RSPEC_GEMS = %w[
23
+ RUBOCOP_GEMS = %w[
24
24
  rubocop
25
25
  rubocop-performance
26
26
  rubocop-rails
@@ -4,10 +4,10 @@
4
4
 
5
5
  <% if safe_autocorrect? -%>
6
6
  **Safe autocorrect: Yes**
7
- :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
7
+ :white_check_mark: The autocorrect a cop does is safe (equivalent) by design.
8
8
  <% else -%>
9
9
  **Safe autocorrect: No**
10
- :warning: The auto-correct a cop can yield false positives by design.
10
+ :warning: The autocorrect a cop can yield false positives by design.
11
11
  <% end -%>
12
12
 
13
13
  ## Description
@@ -4,10 +4,10 @@
4
4
 
5
5
  <% if safe_autocorrect? -%>
6
6
  **Safe autocorrect: Yes**
7
- :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
7
+ :white_check_mark: The autocorrect a cop does is safe (equivalent) by design.
8
8
  <% else -%>
9
9
  **Safe autocorrect: No**
10
- :warning: The auto-correct a cop can yield false positives by design.
10
+ :warning: The autocorrect a cop can yield false positives by design.
11
11
  <% end -%>
12
12
 
13
13
  ## Description
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.8.0
4
+ version: 2.10.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: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2023-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pr_comet
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.5.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.7.0
22
+ version: 0.8.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.5.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.7.0
32
+ version: 0.8.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rainbow
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,90 +44,6 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: rubocop
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0.87'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0.87'
61
- - !ruby/object:Gem::Dependency
62
- name: rubocop-performance
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: rubocop-rails
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rubocop-rake
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- type: :runtime
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- - !ruby/object:Gem::Dependency
104
- name: rubocop-rspec
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- - !ruby/object:Gem::Dependency
118
- name: rubocop-thread_safety
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
47
  - !ruby/object:Gem::Dependency
132
48
  name: thor
133
49
  requirement: !ruby/object:Gem::Requirement
@@ -170,20 +86,6 @@ dependencies:
170
86
  - - ">="
171
87
  - !ruby/object:Gem::Version
172
88
  version: '2.0'
173
- - !ruby/object:Gem::Dependency
174
- name: pry-byebug
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - ">="
178
- - !ruby/object:Gem::Version
179
- version: '0'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- version: '0'
187
89
  - !ruby/object:Gem::Dependency
188
90
  name: rake
189
91
  requirement: !ruby/object:Gem::Requirement
@@ -198,51 +100,23 @@ dependencies:
198
100
  - - "~>"
199
101
  - !ruby/object:Gem::Version
200
102
  version: '13.0'
201
- - !ruby/object:Gem::Dependency
202
- name: rspec
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - ">="
206
- - !ruby/object:Gem::Version
207
- version: '0'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- version: '0'
215
- - !ruby/object:Gem::Dependency
216
- name: rspec_junit_formatter
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - ">="
220
- - !ruby/object:Gem::Version
221
- version: '0'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - ">="
227
- - !ruby/object:Gem::Version
228
- version: '0'
229
103
  - !ruby/object:Gem::Dependency
230
104
  name: simplecov
231
105
  requirement: !ruby/object:Gem::Requirement
232
106
  requirements:
233
107
  - - '='
234
108
  - !ruby/object:Gem::Version
235
- version: 0.21.2
109
+ version: 0.22.0
236
110
  type: :development
237
111
  prerelease: false
238
112
  version_requirements: !ruby/object:Gem::Requirement
239
113
  requirements:
240
114
  - - '='
241
115
  - !ruby/object:Gem::Version
242
- version: 0.21.2
116
+ version: 0.22.0
243
117
  description: Make a clean your rubocop_todo.yml with CI
244
118
  email:
245
- - r-sato@feedforce.jp
119
+ - ryz310@gmail.com
246
120
  executables:
247
121
  - rubocop_challenger
248
122
  extensions: []
@@ -313,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
187
  - !ruby/object:Gem::Version
314
188
  version: '0'
315
189
  requirements: []
316
- rubygems_version: 3.3.11
190
+ rubygems_version: 3.4.6
317
191
  signing_key:
318
192
  specification_version: 4
319
193
  summary: Make a clean your rubocop_todo.yml with CI