rubocop_auto_corrector 0.4.3 → 0.4.4
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/.github/workflows/test.yml +1 -5
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +8 -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 +17 -14
- data/lib/rubocop_auto_corrector/version.rb +1 -1
- data/rubocop_auto_corrector.gemspec +4 -4
- metadata +8 -8
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.5
|
30
26
|
- ruby:2.6
|
31
27
|
- ruby:2.7
|
32
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
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
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`
|
3
10
|
|
4
11
|
## v0.4.3
|
5
12
|
[full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.2...v0.4.3)
|
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
|
[](https://badge.fury.io/rb/rubocop_auto_corrector)
|
6
6
|
[](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] }
|
@@ -49,22 +49,25 @@ module RubocopAutoCorrector
|
|
49
49
|
|
50
50
|
# rubocop:disable Metrics/MethodLength
|
51
51
|
def rubocop_cop_info
|
52
|
+
return @rubocop_cop_info if @rubocop_cop_info
|
53
|
+
|
52
54
|
cop_class_suffix = cop_name.gsub('/', '::')
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
68
71
|
end
|
69
72
|
# rubocop:enable Metrics/MethodLength
|
70
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
|
|
@@ -36,9 +36,9 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
37
|
spec.require_paths = ['lib']
|
38
38
|
|
39
|
-
spec.required_ruby_version = '>= 2.
|
39
|
+
spec.required_ruby_version = '>= 2.6.0'
|
40
40
|
|
41
|
-
spec.add_dependency 'rubocop', '>= 1.
|
41
|
+
spec.add_dependency 'rubocop', '>= 1.3.0'
|
42
42
|
|
43
43
|
spec.add_development_dependency 'bundler', '>= 1.17'
|
44
44
|
spec.add_development_dependency 'coveralls'
|
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
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: 1.
|
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: 1.
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.4.5
|
167
|
-
description: Run `rubocop --
|
167
|
+
description: Run `rubocop --autocorrect && git commit` with each cop.
|
168
168
|
email:
|
169
169
|
- sue445@sue445.net
|
170
170
|
executables:
|
@@ -207,15 +207,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
207
|
requirements:
|
208
208
|
- - ">="
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: 2.
|
210
|
+
version: 2.6.0
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
217
|
+
rubygems_version: 3.3.7
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
|
-
summary: Run `rubocop --
|
220
|
+
summary: Run `rubocop --autocorrect && git commit` with each cop.
|
221
221
|
test_files: []
|