rubocop_auto_corrector 0.3.0 → 0.4.3

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: 2fcacd6c245988923e7e9f5a44f02e20226369b433e9ca1aad691cf1636c1fac
4
- data.tar.gz: 1fab84587b05f21efc81891a0c1f02bf8020e8b2ab11f6cf87422434e838b3d5
3
+ metadata.gz: 1a2679ad72983c8a3eba5331c78de88b409d89b24b4ffff28d1749ebf8a95710
4
+ data.tar.gz: d1c2eb2109af696b61254b55525226988cb18975c95838a513cba19e1f0542db
5
5
  SHA512:
6
- metadata.gz: 43b4bed17887468a0a4ba30e5f8192e2dc7eec0f75f2097eae8b766260d4738e19ae592e5f2a642cf4165e8795da8e7825f5880abe62bf23bdb84e05d658710d
7
- data.tar.gz: fc22e5c34695d74fb16b9252a2e304a13f4c87cf72e0ba44e197ed75e628671d0cf3259ba19f04913c4d7fc959d954c6c59cd73d0655c18510b1cab5675f082a
6
+ metadata.gz: 5618a1266b9bda62b0f310451c70a9fcfdfc2de3b0e411b36270d3a3725abe46083aa27ef57f54a07676705bd6b2ff3e4e72d8a509daf12efa36a89464cd1842
7
+ data.tar.gz: 3e754cb44ebbb4aea4468a011ec76039fa5ab6e8ad6b23aaf5526b79a6b59915e29f23d3743cbfe49345b4cd15289ebd466564713dd5814c35acdb3112b41662
@@ -0,0 +1,113 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+ schedule:
13
+ - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
+
15
+ env:
16
+ CI: "true"
17
+
18
+ jobs:
19
+ test:
20
+ runs-on: ubuntu-latest
21
+
22
+ container: ${{ matrix.ruby }}
23
+
24
+ strategy:
25
+ fail-fast: false
26
+
27
+ matrix:
28
+ ruby:
29
+ - ruby:2.5
30
+ - ruby:2.6
31
+ - ruby:2.7
32
+ - ruby:3.0
33
+ - rubylang/ruby:master-nightly-bionic
34
+ include:
35
+ - ruby: rubylang/ruby:master-nightly-bionic
36
+ allow_failures: "true"
37
+
38
+ steps:
39
+ - uses: actions/checkout@v2
40
+
41
+
42
+ - name: Cache vendor/bundle
43
+ uses: actions/cache@v1
44
+ id: cache_gem
45
+ with:
46
+ path: vendor/bundle
47
+ key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
48
+ restore-keys: |
49
+ v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
50
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
51
+
52
+ - name: bundle update
53
+ run: |
54
+ set -xe
55
+ bundle config path vendor/bundle
56
+ bundle update --jobs $(nproc) --retry 3
57
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
58
+
59
+ - name: Setup Code Climate Test Reporter
60
+ uses: aktions/codeclimate-test-reporter@v1
61
+ with:
62
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
63
+ command: before-build
64
+ continue-on-error: true
65
+
66
+ - name: Set up git
67
+ run: |
68
+ set -xe
69
+ git config --global user.email "github-runner@example.com"
70
+ git config --global user.name "github runner"
71
+
72
+ - name: Run test
73
+ run: |
74
+ set -xe
75
+ bundle exec rspec
76
+ bundle exec rubocop -P
77
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
78
+
79
+ - name: Teardown Code Climate Test Reporter
80
+ uses: aktions/codeclimate-test-reporter@v1
81
+ with:
82
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
83
+ command: after-build
84
+ continue-on-error: true
85
+
86
+ - name: Slack Notification (not success)
87
+ uses: lazy-actions/slatify@master
88
+ if: "! success()"
89
+ continue-on-error: true
90
+ with:
91
+ job_name: ${{ format('*build* ({0})', matrix.ruby) }}
92
+ type: ${{ job.status }}
93
+ icon_emoji: ":octocat:"
94
+ url: ${{ secrets.SLACK_WEBHOOK }}
95
+ token: ${{ secrets.GITHUB_TOKEN }}
96
+
97
+ notify:
98
+ needs:
99
+ - test
100
+
101
+ runs-on: ubuntu-latest
102
+
103
+ steps:
104
+ - name: Slack Notification (success)
105
+ uses: lazy-actions/slatify@master
106
+ if: always()
107
+ continue-on-error: true
108
+ with:
109
+ job_name: '*build*'
110
+ type: ${{ job.status }}
111
+ icon_emoji: ":octocat:"
112
+ url: ${{ secrets.SLACK_WEBHOOK }}
113
+ token: ${{ secrets.GITHUB_TOKEN }}
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ # rubocop 1.13.0+ requires ruby 2.5+
3
+ TargetRubyVersion: 2.5
3
4
 
4
5
  Exclude:
5
6
  - 'spec/dummy/**/*'
@@ -9,12 +10,15 @@ AllCops:
9
10
  - 'vendor/**/*'
10
11
  - '.git/**/*'
11
12
 
13
+ NewCops: enable
14
+ SuggestExtensions: false
15
+
12
16
  Metrics/BlockLength:
13
17
  Exclude:
14
18
  - '*.gemspec'
15
19
  - 'spec/**/*_spec.rb'
16
20
 
17
- Metrics/LineLength:
21
+ Layout/LineLength:
18
22
  Max: 110
19
23
 
20
24
  Style/Documentation:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  ## master
2
- [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.3.0...master)
2
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.3...master)
3
+
4
+ ## v0.4.3
5
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.2...v0.4.3)
6
+
7
+ * Enable MFA requirement for gem releasing
8
+ * https://github.com/sue445/rubocop_auto_corrector/pull/44
9
+
10
+ ## v0.4.2
11
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.1...v0.4.2)
12
+
13
+ * Requires rubocop v1.13.0+ and drop ruby 2.4
14
+ * https://github.com/sue445/rubocop_auto_corrector/pull/43
15
+
16
+ ## v0.4.1
17
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.0...v0.4.1)
18
+
19
+ * Fixed. `auto_correctable?` doesn't work when cop has `.support_autocorrect?` and doesn't have `#autocorrect`
20
+ * https://github.com/sue445/rubocop_auto_corrector/pull/35
21
+
22
+ ## v0.4.0
23
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.3.0...v0.4.0)
24
+
25
+ * Add `--all` option for `rubocop --auto-correct-all`
26
+ * https://github.com/sue445/rubocop_auto_corrector/pull/34
27
+ * When `--all` arg is passed to `rubocop_auto_corrector` (e.g. `rubocop_auto_corrector --all`), run `rubocop --auto-correct-all && git commit` with each cop.
28
+ * Upgrade rubocop and drop support ruby 2.3
29
+ * https://github.com/sue445/rubocop_auto_corrector/pull/31
3
30
 
4
31
  ## v0.3.0
5
32
  [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.2.0...v0.3.0)
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Run `rubocop --auto-correct && 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
- [![Build Status](https://travis-ci.org/sue445/rubocop_auto_corrector.svg?branch=master)](https://travis-ci.org/sue445/rubocop_auto_corrector)
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)
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/384834e50f94e344c439/maintainability)](https://codeclimate.com/github/sue445/rubocop_auto_corrector/maintainability)
8
8
  [![Coverage Status](https://coveralls.io/repos/github/sue445/rubocop_auto_corrector/badge.svg?branch=master)](https://coveralls.io/github/sue445/rubocop_auto_corrector?branch=master)
9
9
 
@@ -42,6 +42,7 @@ $ bundle exec rubocop_auto_corrector
42
42
  $ bundle exec rubocop_auto_corrector --help
43
43
  Usage: rubocop_auto_corrector [options]
44
44
  --auto-correct-count COUNT Run `rubocop --auto-correct` and `git commit` for this number of times. (default. 2)
45
+ --all Whether run `rubocop` with `--auto-correct-all`. (default. run with `--auto-correct`)
45
46
  ```
46
47
 
47
48
  ## Development
@@ -7,7 +7,8 @@ require 'optparse'
7
7
 
8
8
  opt = OptionParser.new
9
9
  params = {
10
- auto_correct_count: 2
10
+ auto_correct_count: 2,
11
+ auto_correct_all: false
11
12
  }
12
13
 
13
14
  Version = RubocopAutoCorrector::VERSION
@@ -19,10 +20,14 @@ opt.on(
19
20
  params[:auto_correct_count] = v.to_i
20
21
  end
21
22
 
23
+ opt.on('--all', 'Whether run `rubocop` with `--auto-correct-all`. (default. run with `--auto-correct`)') do
24
+ params[:auto_correct_all] = true
25
+ end
26
+
22
27
  opt.parse!(ARGV)
23
28
 
24
29
  cli = RubocopAutoCorrector::CLI.new
25
30
 
26
31
  params[:auto_correct_count].times do
27
- cli.perform
32
+ cli.perform(params[:auto_correct_all])
28
33
  end
@@ -15,7 +15,9 @@ module RubocopAutoCorrector
15
15
  @exclude_cops = data['exclude_cops']
16
16
  end
17
17
 
18
- def perform
18
+ def perform(auto_collect_all)
19
+ rubocop_option = auto_collect_all ? '--auto-correct-all' : '--auto-correct'
20
+
19
21
  cop_names = collect_offense_cop_names.select { |cop_name| auto_correctable?(cop_name) }
20
22
  .sort_by { |cop_name| [cop_order(cop_name), cop_name] }
21
23
 
@@ -25,7 +27,7 @@ module RubocopAutoCorrector
25
27
  next
26
28
  end
27
29
 
28
- run_and_commit "rubocop --auto-correct --only #{cop_name}"
30
+ run_and_commit "rubocop #{rubocop_option} --only #{cop_name}"
29
31
  end
30
32
  end
31
33
 
@@ -13,10 +13,20 @@ 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
19
27
  end
28
+
29
+ return #{cop_class_name}.support_autocorrect? if #{cop_class_name}.respond_to?(:support_autocorrect?)
20
30
  #{cop_class_name}.new.respond_to?(:autocorrect)
21
31
  RUBY
22
32
  rescue NameError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopAutoCorrector
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.3'
5
5
  end
@@ -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
- 'public gem pushes.'
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,16 +36,18 @@ 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.3.0'
39
+ spec.required_ruby_version = '>= 2.5.0'
39
40
 
40
- spec.add_dependency 'rubocop', '>= 0.72.0'
41
+ spec.add_dependency 'rubocop', '>= 1.13.0'
41
42
 
42
43
  spec.add_development_dependency 'bundler', '>= 1.17'
43
44
  spec.add_development_dependency 'coveralls'
44
- spec.add_development_dependency 'rake', '~> 10.0'
45
+ spec.add_development_dependency 'rake'
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
- spec.add_development_dependency 'simplecov'
51
+ spec.add_development_dependency 'simplecov', '< 0.18.0'
52
+ spec.add_development_dependency 'unparser', '>= 0.4.5'
50
53
  end
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.3.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-06 00:00:00.000000000 Z
11
+ date: 2021-11-18 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: 0.72.0
19
+ version: 1.13.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.72.0
26
+ version: 1.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  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
@@ -124,18 +138,32 @@ dependencies:
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "<"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.18.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "<"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.18.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: unparser
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - ">="
130
158
  - !ruby/object:Gem::Version
131
- version: '0'
159
+ version: 0.4.5
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
164
  - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: '0'
166
+ version: 0.4.5
139
167
  description: Run `rubocop --auto-correct && git commit` with each cop.
140
168
  email:
141
169
  - sue445@sue445.net
@@ -145,10 +173,10 @@ extensions: []
145
173
  extra_rdoc_files: []
146
174
  files:
147
175
  - ".coveralls.yml"
176
+ - ".github/workflows/test.yml"
148
177
  - ".gitignore"
149
178
  - ".rspec"
150
179
  - ".rubocop.yml"
151
- - ".travis.yml"
152
180
  - CHANGELOG.md
153
181
  - Gemfile
154
182
  - LICENSE.txt
@@ -170,7 +198,8 @@ metadata:
170
198
  homepage_uri: https://github.com/sue445/rubocop_auto_corrector
171
199
  source_code_uri: https://github.com/sue445/rubocop_auto_corrector
172
200
  changelog_uri: https://github.com/sue445/rubocop_auto_corrector/blob/master/CHANGELOG.md
173
- post_install_message:
201
+ rubygems_mfa_required: 'true'
202
+ post_install_message:
174
203
  rdoc_options: []
175
204
  require_paths:
176
205
  - lib
@@ -178,15 +207,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
207
  requirements:
179
208
  - - ">="
180
209
  - !ruby/object:Gem::Version
181
- version: 2.3.0
210
+ version: 2.5.0
182
211
  required_rubygems_version: !ruby/object:Gem::Requirement
183
212
  requirements:
184
213
  - - ">="
185
214
  - !ruby/object:Gem::Version
186
215
  version: '0'
187
216
  requirements: []
188
- rubygems_version: 3.0.3
189
- signing_key:
217
+ rubygems_version: 3.2.22
218
+ signing_key:
190
219
  specification_version: 4
191
220
  summary: Run `rubocop --auto-correct && git commit` with each cop.
192
221
  test_files: []
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - ruby-head
10
- bundler_args: "--jobs=4"
11
- before_install:
12
- - travis_retry gem update --system || travis_retry gem update --system 2.7.8
13
- - travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
14
- before_script:
15
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
16
- - chmod +x ./cc-test-reporter
17
- - ./cc-test-reporter before-build
18
- script:
19
- - RUBYOPT=$RSPEC_RUBYOPT bundle exec rspec
20
- - bundle exec rubocop -P
21
- after_script:
22
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
23
- branches:
24
- only:
25
- - master
26
- notifications:
27
- email: false
28
- slack:
29
- secure: StdMcwf2erVzwfR45Rsw8hKmzaCdg7xl6UzEyPkyrNi1eKS/qeys8Ga1Q5I4HFlmybpBuOTk8dwiya0svGIJtABPUeIe7UjkmGDhS6Q+K+Gk8tNayrvOXgS71JJlqPdTVoWCPqNeqs/a+G9xa/T/TcQgZhh+57Jl9fH4hz/UaXhO0uVuL5LwHvKW6UX35xbAnIdPqMXF7finqF8nxU8nzaGvZ+UrUmnLDIRBeeW1eSopWQP7O+89BM+Nr7vC0oC/fJDcszTnZwYk6b38z9kD8Rvb3H0BktERmeR4QROdokq8BeXKj7uNluHZcr7KQc8qhJA7jAhx326A2oi8C+Yyl4Mz75WsQ+a+JFnVwYgpTXjd4/DnTEA5JUokO2DzsDmcPgnvOgOzAVWdtx3Q96GIcs9vU4X1HuIlctye05ylwVUbOE6up4m47NYLkVmjfYgUq3YVGrqprrlv5gqDqTPb8Il7l+plEobvZhM2cjGx+A/HkpVDgiqfE2IwP3BBeZp5Nkn2P4XUAoFtHkVuTVly55b/Jtnvo83UTv6qJWvTKjM7EorQT9+NlsWe64z5T6VVM6Z5FYHIofFpyRdqSTxcP2AHVpHFckw19px3tC4WiwZzgj4PuMvwcHsgK80wErYOJxlkVAUKuw1nh7g8KZpHjHXp1bCwM6pIK4F9PGMFY/g=
30
- matrix:
31
- allow_failures:
32
- - rvm: ruby-head
33
- include:
34
- - rvm: 2.6
35
- env: RSPEC_RUBYOPT="--jit"
36
- - rvm: ruby-head
37
- env: RSPEC_RUBYOPT="--jit"
38
- env:
39
- global:
40
- - CC_TEST_REPORTER_ID=ae386af24f1ca076680045ecadf328fc77fd71bf6c014b5503d406d8bd87c42a