rubocop_auto_corrector 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +4 -10
- data/.rubocop.yml +3 -1
- data/CHANGELOG.md +20 -1
- data/README.md +4 -3
- data/exe/rubocop_auto_corrector +10 -2
- data/lib/rubocop_auto_corrector/cli.rb +1 -1
- data/lib/rubocop_auto_corrector/cop_finder.rb +25 -14
- data/lib/rubocop_auto_corrector/version.rb +1 -1
- data/rubocop_auto_corrector.gemspec +7 -5
- metadata +26 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e91fedba37711c0aefe1699507efe76c79e3951cf51225f90f9ba4b6c67bae46
|
4
|
+
data.tar.gz: fc9a30691023ff02f207e4f2ba159c8be0d63af1fe7ef0da7cf7a8854eee8608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da0aba556ff5725420c63ccfc01f3a4deee3aed45a3f8d861c7823a85a06d719da999965d8323beff578fbb5268fe727865d15aa7b6fa71469c2cf2bad7f43cb
|
7
|
+
data.tar.gz: fc17bd65c9937e3c503d37c3a7c53c864940e0fe6955a1c7aa282ea864f5c55ec5bb8bea5f88b113e5846248f59ba0e3d86a823b6b7296ab336aa86cc756652e
|
data/.github/workflows/test.yml
CHANGED
@@ -12,9 +12,6 @@ on:
|
|
12
12
|
schedule:
|
13
13
|
- cron: "0 10 * * 5" # JST 19:00 (Fri)
|
14
14
|
|
15
|
-
env:
|
16
|
-
CI: "true"
|
17
|
-
|
18
15
|
jobs:
|
19
16
|
test:
|
20
17
|
runs-on: ubuntu-latest
|
@@ -26,10 +23,10 @@ jobs:
|
|
26
23
|
|
27
24
|
matrix:
|
28
25
|
ruby:
|
29
|
-
- ruby:2.4
|
30
|
-
- ruby:2.5
|
31
26
|
- ruby:2.6
|
32
27
|
- ruby:2.7
|
28
|
+
- ruby:3.0
|
29
|
+
- ruby:3.1
|
33
30
|
- rubylang/ruby:master-nightly-bionic
|
34
31
|
include:
|
35
32
|
- ruby: rubylang/ruby:master-nightly-bionic
|
@@ -38,7 +35,6 @@ jobs:
|
|
38
35
|
steps:
|
39
36
|
- uses: actions/checkout@v2
|
40
37
|
|
41
|
-
|
42
38
|
- name: Cache vendor/bundle
|
43
39
|
uses: actions/cache@v1
|
44
40
|
id: cache_gem
|
@@ -61,7 +57,6 @@ jobs:
|
|
61
57
|
with:
|
62
58
|
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
63
59
|
command: before-build
|
64
|
-
if: matrix.ruby >= 'ruby:2.4'
|
65
60
|
continue-on-error: true
|
66
61
|
|
67
62
|
- name: Set up git
|
@@ -82,11 +77,10 @@ jobs:
|
|
82
77
|
with:
|
83
78
|
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
84
79
|
command: after-build
|
85
|
-
if: matrix.ruby >= 'ruby:2.4' && always()
|
86
80
|
continue-on-error: true
|
87
81
|
|
88
82
|
- name: Slack Notification (not success)
|
89
|
-
uses:
|
83
|
+
uses: lazy-actions/slatify@master
|
90
84
|
if: "! success()"
|
91
85
|
continue-on-error: true
|
92
86
|
with:
|
@@ -104,7 +98,7 @@ jobs:
|
|
104
98
|
|
105
99
|
steps:
|
106
100
|
- name: Slack Notification (success)
|
107
|
-
uses:
|
101
|
+
uses: lazy-actions/slatify@master
|
108
102
|
if: always()
|
109
103
|
continue-on-error: true
|
110
104
|
with:
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
AllCops:
|
2
|
-
|
2
|
+
# rubocop 1.3.0+ requires ruby 2.6+
|
3
|
+
TargetRubyVersion: 2.6
|
3
4
|
|
4
5
|
Exclude:
|
5
6
|
- 'spec/dummy/**/*'
|
@@ -10,6 +11,7 @@ AllCops:
|
|
10
11
|
- '.git/**/*'
|
11
12
|
|
12
13
|
NewCops: enable
|
14
|
+
SuggestExtensions: false
|
13
15
|
|
14
16
|
Metrics/BlockLength:
|
15
17
|
Exclude:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
## master
|
2
|
-
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.
|
2
|
+
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.4...master)
|
3
|
+
|
4
|
+
## v0.4.4
|
5
|
+
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.3...v0.4.4)
|
6
|
+
|
7
|
+
* Migrate to `--autocorrect` and requires rubocop 1.3.0+
|
8
|
+
* https://github.com/sue445/rubocop_auto_corrector/pull/48
|
9
|
+
* `--auto-correct-count` is deprecated, use `--autocorrect-count`
|
10
|
+
|
11
|
+
## v0.4.3
|
12
|
+
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.2...v0.4.3)
|
13
|
+
|
14
|
+
* Enable MFA requirement for gem releasing
|
15
|
+
* https://github.com/sue445/rubocop_auto_corrector/pull/44
|
16
|
+
|
17
|
+
## v0.4.2
|
18
|
+
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.1...v0.4.2)
|
19
|
+
|
20
|
+
* Requires rubocop v1.13.0+ and drop ruby 2.4
|
21
|
+
* https://github.com/sue445/rubocop_auto_corrector/pull/43
|
3
22
|
|
4
23
|
## v0.4.1
|
5
24
|
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.0...v0.4.1)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RubocopAutoCorrector
|
2
2
|
|
3
|
-
Run `rubocop --
|
3
|
+
Run `rubocop --autocorrect && git commit` with each cop.
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/rubocop_auto_corrector.svg)](https://badge.fury.io/rb/rubocop_auto_corrector)
|
6
6
|
[![Build Status](https://github.com/sue445/rubocop_auto_corrector/workflows/test/badge.svg?branch=master)](https://github.com/sue445/rubocop_auto_corrector/actions?query=workflow%3Atest)
|
@@ -41,8 +41,9 @@ $ bundle exec rubocop_auto_corrector
|
|
41
41
|
```bash
|
42
42
|
$ bundle exec rubocop_auto_corrector --help
|
43
43
|
Usage: rubocop_auto_corrector [options]
|
44
|
-
--
|
45
|
-
--
|
44
|
+
--autocorrect-count COUNT Run `rubocop --autocorrect` and `git commit` for this number of times. (default. 2)
|
45
|
+
--auto-correct-count COUNT Same to '--autocorrect-count' (deprecated)
|
46
|
+
--all Whether run `rubocop` with `--autocorrect-all`. (default. run with `--autocorrect`)
|
46
47
|
```
|
47
48
|
|
48
49
|
## Development
|
data/exe/rubocop_auto_corrector
CHANGED
@@ -13,14 +13,22 @@ params = {
|
|
13
13
|
|
14
14
|
Version = RubocopAutoCorrector::VERSION
|
15
15
|
|
16
|
+
opt.on(
|
17
|
+
'--autocorrect-count COUNT',
|
18
|
+
'Run `rubocop --autocorrect` and `git commit` for this number of times. (default. 2)'
|
19
|
+
) do |v|
|
20
|
+
params[:auto_correct_count] = v.to_i
|
21
|
+
end
|
22
|
+
|
16
23
|
opt.on(
|
17
24
|
'--auto-correct-count COUNT',
|
18
|
-
|
25
|
+
"Same to '--autocorrect-count' (deprecated)"
|
19
26
|
) do |v|
|
27
|
+
puts "[DEPRECATED] '--auto-correct-count' is deprecated, use '--autocorrect-count'"
|
20
28
|
params[:auto_correct_count] = v.to_i
|
21
29
|
end
|
22
30
|
|
23
|
-
opt.on('--all', 'Whether run `rubocop` with `--
|
31
|
+
opt.on('--all', 'Whether run `rubocop` with `--autocorrect-all`. (default. run with `--autocorrect`)') do
|
24
32
|
params[:auto_correct_all] = true
|
25
33
|
end
|
26
34
|
|
@@ -16,7 +16,7 @@ module RubocopAutoCorrector
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def perform(auto_collect_all)
|
19
|
-
rubocop_option = auto_collect_all ? '--
|
19
|
+
rubocop_option = auto_collect_all ? '--autocorrect-all' : '--autocorrect'
|
20
20
|
|
21
21
|
cop_names = collect_offense_cop_names.select { |cop_name| auto_correctable?(cop_name) }
|
22
22
|
.sort_by { |cop_name| [cop_order(cop_name), cop_name] }
|
@@ -13,6 +13,14 @@ module RubocopAutoCorrector
|
|
13
13
|
# @return [Boolean]
|
14
14
|
def auto_correctable?
|
15
15
|
Object.new.instance_eval <<-RUBY, __FILE__, __LINE__ + 1
|
16
|
+
# begin
|
17
|
+
# require 'rubocop-rspec'
|
18
|
+
# rescue LoadError
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# return ::RuboCop::Cop::RSpec::AlignLeftLetBrace.support_autocorrect? if ::RuboCop::Cop::RSpec::AlignLeftLetBrace.respond_to?(:support_autocorrect?)
|
22
|
+
# ::RuboCop::Cop::RSpec::AlignLeftLetBrace.new.respond_to?(:autocorrect)
|
23
|
+
|
16
24
|
begin
|
17
25
|
require '#{gem_name}'
|
18
26
|
rescue LoadError
|
@@ -41,22 +49,25 @@ module RubocopAutoCorrector
|
|
41
49
|
|
42
50
|
# rubocop:disable Metrics/MethodLength
|
43
51
|
def rubocop_cop_info
|
52
|
+
return @rubocop_cop_info if @rubocop_cop_info
|
53
|
+
|
44
54
|
cop_class_suffix = cop_name.gsub('/', '::')
|
45
55
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
@rubocop_cop_info =
|
57
|
+
case cop_name
|
58
|
+
when %r{^RSpec/}
|
59
|
+
['rubocop-rspec', "::RuboCop::Cop::#{cop_class_suffix}"]
|
60
|
+
when %r{^(FactoryBot|Capybara)/}, 'Rails/HttpStatus'
|
61
|
+
['rubocop-rspec', "::RuboCop::Cop::RSpec::#{cop_class_suffix}"]
|
62
|
+
when %r{^(Layout|Lint|Metrics|Naming|Security|Style|Bundler|Gemspec)/}
|
63
|
+
# Official cops
|
64
|
+
['rubocop', "::RuboCop::Cop::#{cop_class_suffix}"]
|
65
|
+
else
|
66
|
+
# Unknown cops
|
67
|
+
department_camel = cop_name.split('/').first
|
68
|
+
department_snake = department_camel.gsub(/(?<=.)([A-Z])/) { |s| "_#{s}" }.downcase
|
69
|
+
["rubocop-#{department_snake}", "::RuboCop::Cop::#{cop_class_suffix}"]
|
70
|
+
end
|
60
71
|
end
|
61
72
|
# rubocop:enable Metrics/MethodLength
|
62
73
|
end
|
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ['sue445']
|
11
11
|
spec.email = ['sue445@sue445.net']
|
12
12
|
|
13
|
-
spec.summary = 'Run `rubocop --
|
14
|
-
spec.description = 'Run `rubocop --
|
13
|
+
spec.summary = 'Run `rubocop --autocorrect && git commit` with each cop.'
|
14
|
+
spec.description = 'Run `rubocop --autocorrect && git commit` with each cop.'
|
15
15
|
spec.homepage = 'https://github.com/sue445/rubocop_auto_corrector'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
@@ -21,9 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
22
|
spec.metadata['source_code_uri'] = spec.homepage
|
23
23
|
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
24
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
24
25
|
else
|
25
26
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
26
|
-
|
27
|
+
'public gem pushes.'
|
27
28
|
end
|
28
29
|
|
29
30
|
# Specify which files should be added to the gem when it is released.
|
@@ -35,9 +36,9 @@ Gem::Specification.new do |spec|
|
|
35
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
37
|
spec.require_paths = ['lib']
|
37
38
|
|
38
|
-
spec.required_ruby_version = '>= 2.
|
39
|
+
spec.required_ruby_version = '>= 2.6.0'
|
39
40
|
|
40
|
-
spec.add_dependency 'rubocop', '>=
|
41
|
+
spec.add_dependency 'rubocop', '>= 1.3.0'
|
41
42
|
|
42
43
|
spec.add_development_dependency 'bundler', '>= 1.17'
|
43
44
|
spec.add_development_dependency 'coveralls'
|
@@ -45,6 +46,7 @@ Gem::Specification.new do |spec|
|
|
45
46
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
46
47
|
spec.add_development_dependency 'rspec-parameterized'
|
47
48
|
spec.add_development_dependency 'rspec-temp_dir', '>= 1.1.0'
|
49
|
+
spec.add_development_dependency 'rubocop', '>= 1.23.0'
|
48
50
|
spec.add_development_dependency 'rubocop-rspec'
|
49
51
|
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
50
52
|
spec.add_development_dependency 'unparser', '>= 0.4.5'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop_auto_corrector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.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:
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.1.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.23.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.23.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rubocop-rspec
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +164,7 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: 0.4.5
|
153
|
-
description: Run `rubocop --
|
167
|
+
description: Run `rubocop --autocorrect && git commit` with each cop.
|
154
168
|
email:
|
155
169
|
- sue445@sue445.net
|
156
170
|
executables:
|
@@ -184,7 +198,8 @@ metadata:
|
|
184
198
|
homepage_uri: https://github.com/sue445/rubocop_auto_corrector
|
185
199
|
source_code_uri: https://github.com/sue445/rubocop_auto_corrector
|
186
200
|
changelog_uri: https://github.com/sue445/rubocop_auto_corrector/blob/master/CHANGELOG.md
|
187
|
-
|
201
|
+
rubygems_mfa_required: 'true'
|
202
|
+
post_install_message:
|
188
203
|
rdoc_options: []
|
189
204
|
require_paths:
|
190
205
|
- lib
|
@@ -192,15 +207,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
207
|
requirements:
|
193
208
|
- - ">="
|
194
209
|
- !ruby/object:Gem::Version
|
195
|
-
version: 2.
|
210
|
+
version: 2.6.0
|
196
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
212
|
requirements:
|
198
213
|
- - ">="
|
199
214
|
- !ruby/object:Gem::Version
|
200
215
|
version: '0'
|
201
216
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
203
|
-
signing_key:
|
217
|
+
rubygems_version: 3.3.7
|
218
|
+
signing_key:
|
204
219
|
specification_version: 4
|
205
|
-
summary: Run `rubocop --
|
220
|
+
summary: Run `rubocop --autocorrect && git commit` with each cop.
|
206
221
|
test_files: []
|