rubocop_auto_corrector 0.3.0 → 0.4.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: 2fcacd6c245988923e7e9f5a44f02e20226369b433e9ca1aad691cf1636c1fac
4
- data.tar.gz: 1fab84587b05f21efc81891a0c1f02bf8020e8b2ab11f6cf87422434e838b3d5
3
+ metadata.gz: 509d6918b9fdfe52298f58bbe9be36931e3dd47115becd4e4fda20de29dec3ef
4
+ data.tar.gz: f65fd537d05dc43b5c7e33d525781a67f2941b4f77e63caad3edae309d15a29f
5
5
  SHA512:
6
- metadata.gz: 43b4bed17887468a0a4ba30e5f8192e2dc7eec0f75f2097eae8b766260d4738e19ae592e5f2a642cf4165e8795da8e7825f5880abe62bf23bdb84e05d658710d
7
- data.tar.gz: fc22e5c34695d74fb16b9252a2e304a13f4c87cf72e0ba44e197ed75e628671d0cf3259ba19f04913c4d7fc959d954c6c59cd73d0655c18510b1cab5675f082a
6
+ metadata.gz: 5096bf602e4f4158c9f4daeee6f02ceb7f1dd144bcc4d3a46d01afecc3bfe55ed5e3ee73aa909f4ef2e4765c829e86091d56b40038f1b5c1c85f1da80c576855
7
+ data.tar.gz: 228c3f22ecad65538f108e3218079866e2c7b1071cca78e6dc266ec6e297ff950a719610a73fd88b9c7a1555c18f4180f4fc374cc2fb156ffa41e8b59043667f
@@ -0,0 +1,115 @@
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.4
30
+ - ruby:2.5
31
+ - ruby:2.6
32
+ - ruby:2.7
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
+ if: matrix.ruby >= 'ruby:2.4'
65
+ continue-on-error: true
66
+
67
+ - name: Set up git
68
+ run: |
69
+ set -xe
70
+ git config --global user.email "github-runner@example.com"
71
+ git config --global user.name "github runner"
72
+
73
+ - name: Run test
74
+ run: |
75
+ set -xe
76
+ bundle exec rspec
77
+ bundle exec rubocop -P
78
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
79
+
80
+ - name: Teardown Code Climate Test Reporter
81
+ uses: aktions/codeclimate-test-reporter@v1
82
+ with:
83
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
84
+ command: after-build
85
+ if: matrix.ruby >= 'ruby:2.4' && always()
86
+ continue-on-error: true
87
+
88
+ - name: Slack Notification (not success)
89
+ uses: homoluctus/slatify@master
90
+ if: "! success()"
91
+ continue-on-error: true
92
+ with:
93
+ job_name: ${{ format('*build* ({0})', matrix.ruby) }}
94
+ type: ${{ job.status }}
95
+ icon_emoji: ":octocat:"
96
+ url: ${{ secrets.SLACK_WEBHOOK }}
97
+ token: ${{ secrets.GITHUB_TOKEN }}
98
+
99
+ notify:
100
+ needs:
101
+ - test
102
+
103
+ runs-on: ubuntu-latest
104
+
105
+ steps:
106
+ - name: Slack Notification (success)
107
+ uses: homoluctus/slatify@master
108
+ if: always()
109
+ continue-on-error: true
110
+ with:
111
+ job_name: '*build*'
112
+ type: ${{ job.status }}
113
+ icon_emoji: ":octocat:"
114
+ url: ${{ secrets.SLACK_WEBHOOK }}
115
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.4
3
3
 
4
4
  Exclude:
5
5
  - 'spec/dummy/**/*'
@@ -9,12 +9,14 @@ AllCops:
9
9
  - 'vendor/**/*'
10
10
  - '.git/**/*'
11
11
 
12
+ NewCops: enable
13
+
12
14
  Metrics/BlockLength:
13
15
  Exclude:
14
16
  - '*.gemspec'
15
17
  - 'spec/**/*_spec.rb'
16
18
 
17
- Metrics/LineLength:
19
+ Layout/LineLength:
18
20
  Max: 110
19
21
 
20
22
  Style/Documentation:
@@ -1,5 +1,14 @@
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.0...master)
3
+
4
+ ## v0.4.0
5
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.3.0...v0.4.0)
6
+
7
+ * Add `--all` option for `rubocop --auto-correct-all`
8
+ * https://github.com/sue445/rubocop_auto_corrector/pull/34
9
+ * 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.
10
+ * Upgrade rubocop and drop support ruby 2.3
11
+ * https://github.com/sue445/rubocop_auto_corrector/pull/31
3
12
 
4
13
  ## v0.3.0
5
14
  [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
 
@@ -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.0'
5
5
  end
@@ -35,16 +35,17 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ['lib']
37
37
 
38
- spec.required_ruby_version = '>= 2.3.0'
38
+ spec.required_ruby_version = '>= 2.4.0'
39
39
 
40
- spec.add_dependency 'rubocop', '>= 0.72.0'
40
+ spec.add_dependency 'rubocop', '>= 0.87.0'
41
41
 
42
42
  spec.add_development_dependency 'bundler', '>= 1.17'
43
43
  spec.add_development_dependency 'coveralls'
44
- spec.add_development_dependency 'rake', '~> 10.0'
44
+ spec.add_development_dependency 'rake'
45
45
  spec.add_development_dependency 'rspec', '~> 3.0'
46
46
  spec.add_development_dependency 'rspec-parameterized'
47
47
  spec.add_development_dependency 'rspec-temp_dir', '>= 1.1.0'
48
48
  spec.add_development_dependency 'rubocop-rspec'
49
- spec.add_development_dependency 'simplecov'
49
+ spec.add_development_dependency 'simplecov', '< 0.18.0'
50
+ spec.add_development_dependency 'unparser', '>= 0.4.5'
50
51
  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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-06 00:00:00.000000000 Z
11
+ date: 2020-07-07 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: 0.87.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: 0.87.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
@@ -124,18 +124,32 @@ dependencies:
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.18.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.18.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: unparser
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '0'
145
+ version: 0.4.5
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '0'
152
+ version: 0.4.5
139
153
  description: Run `rubocop --auto-correct && git commit` with each cop.
140
154
  email:
141
155
  - sue445@sue445.net
@@ -145,10 +159,10 @@ extensions: []
145
159
  extra_rdoc_files: []
146
160
  files:
147
161
  - ".coveralls.yml"
162
+ - ".github/workflows/test.yml"
148
163
  - ".gitignore"
149
164
  - ".rspec"
150
165
  - ".rubocop.yml"
151
- - ".travis.yml"
152
166
  - CHANGELOG.md
153
167
  - Gemfile
154
168
  - LICENSE.txt
@@ -178,14 +192,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
192
  requirements:
179
193
  - - ">="
180
194
  - !ruby/object:Gem::Version
181
- version: 2.3.0
195
+ version: 2.4.0
182
196
  required_rubygems_version: !ruby/object:Gem::Requirement
183
197
  requirements:
184
198
  - - ">="
185
199
  - !ruby/object:Gem::Version
186
200
  version: '0'
187
201
  requirements: []
188
- rubygems_version: 3.0.3
202
+ rubygems_version: 3.1.2
189
203
  signing_key:
190
204
  specification_version: 4
191
205
  summary: Run `rubocop --auto-correct && git commit` with each cop.
@@ -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