rubocop_auto_corrector 0.4.4 → 0.5.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: e91fedba37711c0aefe1699507efe76c79e3951cf51225f90f9ba4b6c67bae46
4
- data.tar.gz: fc9a30691023ff02f207e4f2ba159c8be0d63af1fe7ef0da7cf7a8854eee8608
3
+ metadata.gz: 64e6102fe91fd3839e15fb4eb332a0b4fbeb294a5da572dbaef62fafe7743161
4
+ data.tar.gz: 53f1dbbbf0415180b4bae3db5446d787d42a08fed7c021fa8adecd05b78d2393
5
5
  SHA512:
6
- metadata.gz: da0aba556ff5725420c63ccfc01f3a4deee3aed45a3f8d861c7823a85a06d719da999965d8323beff578fbb5268fe727865d15aa7b6fa71469c2cf2bad7f43cb
7
- data.tar.gz: fc17bd65c9937e3c503d37c3a7c53c864940e0fe6955a1c7aa282ea864f5c55ec5bb8bea5f88b113e5846248f59ba0e3d86a823b6b7296ab336aa86cc756652e
6
+ metadata.gz: '09a1afa77bfbfec27f59b2a8661ac41fc320b868263e52c4721b071d0f9afefde6d9b0aff35e4bb70c19777743468d0b0cd935df4e4a952df3f9eaedab97fd59'
7
+ data.tar.gz: a05f259099b5f21bcf1f1835bdc9698518e53cd0ef43f907f0e0f36b1f489b38bfe83e60c4b11f3639d5704fc9ef1d1514bd84cfa224b1ba11adb5a450a2b4a1
@@ -0,0 +1,10 @@
1
+ # c.f. https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: github-actions
6
+ directory: /
7
+ schedule:
8
+ interval: weekly
9
+ assignees:
10
+ - sue445
@@ -0,0 +1,59 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow one concurrent deployment
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ruby
38
+ bundler-cache: true
39
+
40
+ - run: bundle exec yard
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v5
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ # Upload entire repository
48
+ path: './doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@main
52
+
53
+ - name: Slack Notification (not success)
54
+ uses: act10ns/slack@v2
55
+ if: "! success()"
56
+ continue-on-error: true
57
+ with:
58
+ status: ${{ job.status }}
59
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
@@ -16,41 +16,27 @@ jobs:
16
16
  test:
17
17
  runs-on: ubuntu-latest
18
18
 
19
- container: ${{ matrix.ruby }}
20
-
21
19
  strategy:
22
20
  fail-fast: false
23
21
 
24
22
  matrix:
25
23
  ruby:
26
- - ruby:2.6
27
- - ruby:2.7
28
- - ruby:3.0
29
- - ruby:3.1
30
- - rubylang/ruby:master-nightly-bionic
31
- include:
32
- - ruby: rubylang/ruby:master-nightly-bionic
33
- allow_failures: "true"
24
+ - "2.6"
25
+ - "2.7"
26
+ - "3.0"
27
+ - "3.1"
28
+ - "3.2"
29
+ - "3.3"
34
30
 
35
31
  steps:
36
- - uses: actions/checkout@v2
32
+ - uses: actions/checkout@v4
37
33
 
38
- - name: Cache vendor/bundle
39
- uses: actions/cache@v1
40
- id: cache_gem
34
+ - uses: ruby/setup-ruby@v1
41
35
  with:
42
- path: vendor/bundle
43
- key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
44
- restore-keys: |
45
- v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
46
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
47
38
 
48
- - name: bundle update
49
- run: |
50
- set -xe
51
- bundle config path vendor/bundle
52
- bundle update --jobs $(nproc) --retry 3
53
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
39
+ - run: bundle update --jobs $(nproc) --retry 3
54
40
 
55
41
  - name: Setup Code Climate Test Reporter
56
42
  uses: aktions/codeclimate-test-reporter@v1
@@ -65,12 +51,8 @@ jobs:
65
51
  git config --global user.email "github-runner@example.com"
66
52
  git config --global user.name "github runner"
67
53
 
68
- - name: Run test
69
- run: |
70
- set -xe
71
- bundle exec rspec
72
- bundle exec rubocop -P
73
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
54
+ - run: bundle exec rspec
55
+ - run: bundle exec rubocop -P
74
56
 
75
57
  - name: Teardown Code Climate Test Reporter
76
58
  uses: aktions/codeclimate-test-reporter@v1
@@ -80,15 +62,13 @@ jobs:
80
62
  continue-on-error: true
81
63
 
82
64
  - name: Slack Notification (not success)
83
- uses: lazy-actions/slatify@master
65
+ uses: act10ns/slack@v2
84
66
  if: "! success()"
85
67
  continue-on-error: true
86
68
  with:
87
- job_name: ${{ format('*build* ({0})', matrix.ruby) }}
88
- type: ${{ job.status }}
89
- icon_emoji: ":octocat:"
90
- url: ${{ secrets.SLACK_WEBHOOK }}
91
- token: ${{ secrets.GITHUB_TOKEN }}
69
+ status: ${{ job.status }}
70
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
71
+ matrix: ${{ toJson(matrix) }}
92
72
 
93
73
  notify:
94
74
  needs:
@@ -98,12 +78,9 @@ jobs:
98
78
 
99
79
  steps:
100
80
  - name: Slack Notification (success)
101
- uses: lazy-actions/slatify@master
81
+ uses: act10ns/slack@v2
102
82
  if: always()
103
83
  continue-on-error: true
104
84
  with:
105
- job_name: '*build*'
106
- type: ${{ job.status }}
107
- icon_emoji: ":octocat:"
108
- url: ${{ secrets.SLACK_WEBHOOK }}
109
- token: ${{ secrets.GITHUB_TOKEN }}
85
+ status: ${{ job.status }}
86
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
data/.rubocop.yml CHANGED
@@ -13,6 +13,9 @@ AllCops:
13
13
  NewCops: enable
14
14
  SuggestExtensions: false
15
15
 
16
+ Gemspec/DevelopmentDependencies:
17
+ EnforcedStyle: gemspec
18
+
16
19
  Metrics/BlockLength:
17
20
  Exclude:
18
21
  - '*.gemspec'
@@ -23,3 +26,7 @@ Layout/LineLength:
23
26
 
24
27
  Style/Documentation:
25
28
  Enabled: false
29
+
30
+ Style/IfUnlessModifier:
31
+ Exclude:
32
+ - Gemfile
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ --markup markdown
2
+ --no-private
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## master
2
- [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.4...master)
2
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.5.0...master)
3
+
4
+ ## v0.5.0
5
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.5...v0.5.0)
6
+
7
+ * Support rubocop-rspec v3+
8
+ * https://github.com/sue445/rubocop_auto_corrector/pull/69
9
+
10
+ ## v0.4.5
11
+ [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.4...v0.4.5)
12
+
13
+ * Requires rubocop 1.30.0+
14
+ * https://github.com/sue445/rubocop_auto_corrector/pull/67
3
15
 
4
16
  ## v0.4.4
5
17
  [full changelog](http://github.com/sue445/rubocop_auto_corrector/compare/v0.4.3...v0.4.4)
data/Gemfile CHANGED
@@ -6,3 +6,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in rubocop_auto_corrector.gemspec
8
8
  gemspec
9
+
10
+ # rubocop:disable Gemspec/DevelopmentDependencies
11
+ if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.7.0')
12
+ gem 'rubocop-factory_bot'
13
+ end
14
+ # rubocop:enable Gemspec/DevelopmentDependencies
@@ -11,63 +11,100 @@ module RubocopAutoCorrector
11
11
 
12
12
  # Whether this cop is auto correctable
13
13
  # @return [Boolean]
14
- def auto_correctable?
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)
14
+ def auto_correctable? # rubocop:disable Metrics/MethodLength
15
+ cop_candidacies.any? do |cop_candidacy|
16
+ gem_name = cop_candidacy[:gem_name]
17
+ cop_class_name = cop_candidacy[:cop_class_name]
23
18
 
24
- begin
25
- require '#{gem_name}'
26
- rescue LoadError
27
- end
19
+ Object.new.instance_eval <<-RUBY, __FILE__, __LINE__ + 1
20
+ # begin
21
+ # require 'rubocop-rspec'
22
+ # rescue LoadError
23
+ # end
24
+ #
25
+ # return ::RuboCop::Cop::RSpec::AlignLeftLetBrace.support_autocorrect? if ::RuboCop::Cop::RSpec::AlignLeftLetBrace.respond_to?(:support_autocorrect?)
26
+ # ::RuboCop::Cop::RSpec::AlignLeftLetBrace.new.respond_to?(:autocorrect)
28
27
 
29
- return #{cop_class_name}.support_autocorrect? if #{cop_class_name}.respond_to?(:support_autocorrect?)
30
- #{cop_class_name}.new.respond_to?(:autocorrect)
31
- RUBY
32
- rescue NameError
33
- false
34
- end
35
-
36
- # @return [String]
37
- def gem_name
38
- gem_name, = rubocop_cop_info
39
- gem_name
40
- end
28
+ begin
29
+ require '#{gem_name}'
30
+ rescue LoadError
31
+ end
41
32
 
42
- # @return [String]
43
- def cop_class_name
44
- _, cop_class = rubocop_cop_info
45
- cop_class
33
+ return #{cop_class_name}.support_autocorrect? if #{cop_class_name}.respond_to?(:support_autocorrect?)
34
+ #{cop_class_name}.new.respond_to?(:autocorrect)
35
+ RUBY
36
+ rescue NameError
37
+ false
38
+ end
46
39
  end
47
40
 
48
- private
49
-
50
41
  # rubocop:disable Metrics/MethodLength
51
- def rubocop_cop_info
52
- return @rubocop_cop_info if @rubocop_cop_info
53
-
42
+ # @return [Array<Hash<Symbol, String>>]
43
+ def cop_candidacies
54
44
  cop_class_suffix = cop_name.gsub('/', '::')
55
45
 
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
46
+ case cop_name
47
+ when %r{^RSpec/}
48
+ [
49
+ {
50
+ gem_name: 'rubocop-rspec',
51
+ cop_class_name: "::RuboCop::Cop::#{cop_class_suffix}"
52
+ }
53
+ ]
54
+ when 'Rails/HttpStatus'
55
+ [
56
+ # for rubocop-rspec < 2.28.0
57
+ {
58
+ gem_name: 'rubocop-rspec',
59
+ cop_class_name: "::RuboCop::Cop::RSpec::#{cop_class_suffix}"
60
+ }
61
+ ]
62
+ when %r{^FactoryBot/}
63
+ [
64
+ # for rubocop-rspec < 2.0.0
65
+ {
66
+ gem_name: 'rubocop-rspec',
67
+ cop_class_name: "::RuboCop::Cop::RSpec::#{cop_class_suffix}"
68
+ },
69
+ # for rubocop-rspec v3+
70
+ {
71
+ gem_name: 'rubocop-factory_bot',
72
+ cop_class_name: "::RuboCop::Cop::#{cop_class_suffix}"
73
+ }
74
+ ]
75
+ when %r{^Capybara/}
76
+ [
77
+ # for rubocop-rspec < 2.0.0
78
+ {
79
+ gem_name: 'rubocop-rspec',
80
+ cop_class_name: "::RuboCop::Cop::RSpec::#{cop_class_suffix}"
81
+ },
82
+ # for rubocop-rspec v3+
83
+ {
84
+ gem_name: 'rubocop-capybara',
85
+ cop_class_name: "::RuboCop::Cop::#{cop_class_suffix}"
86
+ }
87
+ ]
88
+ when %r{^(Layout|Lint|Metrics|Naming|Security|Style|Bundler|Gemspec)/}
89
+ # Official cops
90
+ [
91
+ {
92
+ gem_name: 'rubocop',
93
+ cop_class_name: "::RuboCop::Cop::#{cop_class_suffix}"
94
+ }
95
+ ]
96
+ else
97
+ # Unknown cops
98
+ department_camel = cop_name.split('/').first
99
+ department_snake = department_camel.gsub(/(?<=.)([A-Z])/) { |s| "_#{s}" }.downcase
100
+
101
+ [
102
+ {
103
+ gem_name: "rubocop-#{department_snake}",
104
+ cop_class_name: "::RuboCop::Cop::#{cop_class_suffix}"
105
+ }
106
+ ]
107
+ end
71
108
  end
72
109
  # rubocop:enable Metrics/MethodLength
73
110
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopAutoCorrector
4
- VERSION = '0.4.4'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -15,17 +15,11 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://github.com/sue445/rubocop_auto_corrector'
16
16
  spec.license = 'MIT'
17
17
 
18
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
- # to allow pushing to a single host or delete this section to allow pushing to any host.
20
- if spec.respond_to?(:metadata)
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] = spec.homepage
23
- spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
24
- spec.metadata['rubygems_mfa_required'] = 'true'
25
- else
26
- raise 'RubyGems 2.0 or newer is required to protect against ' \
27
- 'public gem pushes.'
28
- end
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = spec.homepage
20
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
21
+ spec.metadata['documentation_uri'] = 'https://sue445.github.io/rubocop_auto_corrector/'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
29
23
 
30
24
  # Specify which files should be added to the gem when it is released.
31
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -38,10 +32,10 @@ Gem::Specification.new do |spec|
38
32
 
39
33
  spec.required_ruby_version = '>= 2.6.0'
40
34
 
41
- spec.add_dependency 'rubocop', '>= 1.3.0'
35
+ spec.add_dependency 'rubocop', '>= 1.30.0'
42
36
 
43
37
  spec.add_development_dependency 'bundler', '>= 1.17'
44
- spec.add_development_dependency 'coveralls'
38
+ spec.add_development_dependency 'coveralls_reborn'
45
39
  spec.add_development_dependency 'rake'
46
40
  spec.add_development_dependency 'rspec', '~> 3.0'
47
41
  spec.add_development_dependency 'rspec-parameterized'
@@ -50,4 +44,5 @@ Gem::Specification.new do |spec|
50
44
  spec.add_development_dependency 'rubocop-rspec'
51
45
  spec.add_development_dependency 'simplecov', '< 0.18.0'
52
46
  spec.add_development_dependency 'unparser', '>= 0.4.5'
47
+ spec.add_development_dependency 'yard'
53
48
  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.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-01 00:00:00.000000000 Z
11
+ date: 2024-06-14 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.3.0
19
+ version: 1.30.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.3.0
26
+ version: 1.30.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.17'
41
41
  - !ruby/object:Gem::Dependency
42
- name: coveralls
42
+ name: coveralls_reborn
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.4.5
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: Run `rubocop --autocorrect && git commit` with each cop.
168
182
  email:
169
183
  - sue445@sue445.net
@@ -173,10 +187,13 @@ extensions: []
173
187
  extra_rdoc_files: []
174
188
  files:
175
189
  - ".coveralls.yml"
190
+ - ".github/dependabot.yml"
191
+ - ".github/workflows/pages.yml"
176
192
  - ".github/workflows/test.yml"
177
193
  - ".gitignore"
178
194
  - ".rspec"
179
195
  - ".rubocop.yml"
196
+ - ".yardopts"
180
197
  - CHANGELOG.md
181
198
  - Gemfile
182
199
  - LICENSE.txt
@@ -198,6 +215,7 @@ metadata:
198
215
  homepage_uri: https://github.com/sue445/rubocop_auto_corrector
199
216
  source_code_uri: https://github.com/sue445/rubocop_auto_corrector
200
217
  changelog_uri: https://github.com/sue445/rubocop_auto_corrector/blob/master/CHANGELOG.md
218
+ documentation_uri: https://sue445.github.io/rubocop_auto_corrector/
201
219
  rubygems_mfa_required: 'true'
202
220
  post_install_message:
203
221
  rdoc_options: []
@@ -214,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
232
  - !ruby/object:Gem::Version
215
233
  version: '0'
216
234
  requirements: []
217
- rubygems_version: 3.3.7
235
+ rubygems_version: 3.5.9
218
236
  signing_key:
219
237
  specification_version: 4
220
238
  summary: Run `rubocop --autocorrect && git commit` with each cop.