rubocop-migration 0.7.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0022087bc8e99cf2bc4e2f3baedb7b2b0ad587ff426f9bcd340646553662c866'
4
- data.tar.gz: ce12e03910ea987ce6a38b809e30e62a37ce22faf0d9ab6c48c0fb4d3b482e5c
3
+ metadata.gz: '0813a8046835fbb1c8382152971eaada39e144aabb2266cda2115b2e5c2a1398'
4
+ data.tar.gz: 38580189a800f01224c4dbfd39d7aed4707509d148ec1deed74e936858a99624
5
5
  SHA512:
6
- metadata.gz: 536056846d52490c2fdebbedafb3e4db06704a3f18bb6c1bcf7fbcb9f85e19bc3385f0911fb9358a26bbf4e2c0d56338fd5790821b7881297c51dd73fb9c3356
7
- data.tar.gz: 6c4b6f308b59b2cfcf50cde30072d848f5c5656cba79f0b2248b02a5ef2daf169d9f76d92090ac6e18284f4803a20bd38c80258fc3693254e0a1c9051fbf8114
6
+ metadata.gz: 65e716d2e0cecb340f2e8171d125d901f7eb8e53352227fa472e4489da1c8b97c04000ae6bb59080f2a7d811e9cc2c1dad3248d9624a00f90fba3b2ce55c7e93
7
+ data.tar.gz: 4bb8b248e3f0bc57767bc0be615a27d31d663f89e2d8eddd67e30102cbbfe6d49f1bd119db3b6a3fae5593f0751b5862e1af993e90e0f6514e788faadb8d6314
data/.rubocop.yml CHANGED
@@ -4,13 +4,11 @@ plugins:
4
4
  - rubocop-rspec
5
5
  - rubocop-performance
6
6
  - rubocop-rake
7
-
8
- require:
9
7
  - sevencop
10
8
 
11
9
  AllCops:
12
10
  NewCops: enable
13
- TargetRubyVersion: 2.7
11
+ TargetRubyVersion: 3.3
14
12
 
15
13
  # To automate release workflow.
16
14
  Gemspec/RequireMFA:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-migration (0.7.0)
4
+ rubocop-migration (0.8.0)
5
5
  activesupport
6
6
  lint_roller (>= 1.1)
7
7
  rubocop (>= 1.72.1)
@@ -10,98 +10,101 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.1.5.1)
13
+ activesupport (8.1.4)
14
14
  base64
15
- benchmark (>= 0.3)
16
15
  bigdecimal
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ concurrent-ruby (~> 1.0, >= 1.3.1)
18
17
  connection_pool (>= 2.2.5)
19
18
  drb
20
19
  i18n (>= 1.6, < 2)
20
+ json
21
21
  logger (>= 1.4.2)
22
22
  minitest (>= 5.1)
23
- mutex_m
24
23
  securerandom (>= 0.3)
25
- tzinfo (~> 2.0)
24
+ tzinfo (~> 2.0, >= 2.0.5)
25
+ uri (>= 0.13.1)
26
26
  ast (2.4.3)
27
- base64 (0.2.0)
28
- benchmark (0.4.0)
29
- bigdecimal (3.1.9)
30
- concurrent-ruby (1.3.5)
31
- connection_pool (2.5.0)
32
- diff-lcs (1.6.1)
33
- drb (2.2.1)
34
- i18n (1.14.7)
27
+ base64 (0.3.0)
28
+ bigdecimal (4.1.3)
29
+ concurrent-ruby (1.3.8)
30
+ connection_pool (3.0.2)
31
+ diff-lcs (1.6.2)
32
+ drb (2.2.3)
33
+ i18n (1.15.2)
35
34
  concurrent-ruby (~> 1.0)
36
- json (2.10.2)
37
- language_server-protocol (3.17.0.4)
35
+ json (3.1.0)
36
+ language_server-protocol (3.17.0.6)
38
37
  lint_roller (1.1.0)
39
38
  logger (1.7.0)
40
- minitest (5.25.5)
41
- mutex_m (0.3.0)
42
- parallel (1.26.3)
43
- parser (3.3.7.4)
39
+ minitest (6.0.6)
40
+ drb (~> 2.0)
41
+ prism (~> 1.5)
42
+ parallel (2.3.0)
43
+ parser (3.3.13.0)
44
44
  ast (~> 2.4.1)
45
45
  racc
46
- prism (1.4.0)
46
+ prism (1.9.0)
47
47
  racc (1.8.1)
48
- rack (3.1.12)
48
+ rack (3.2.8)
49
49
  rainbow (3.1.1)
50
- rake (13.2.1)
51
- regexp_parser (2.10.0)
52
- rspec (3.13.0)
50
+ rake (13.4.2)
51
+ regexp_parser (2.13.1)
52
+ rspec (3.13.2)
53
53
  rspec-core (~> 3.13.0)
54
54
  rspec-expectations (~> 3.13.0)
55
55
  rspec-mocks (~> 3.13.0)
56
- rspec-core (3.13.3)
56
+ rspec-core (3.13.6)
57
57
  rspec-support (~> 3.13.0)
58
- rspec-expectations (3.13.3)
58
+ rspec-expectations (3.13.5)
59
59
  diff-lcs (>= 1.2.0, < 2.0)
60
60
  rspec-support (~> 3.13.0)
61
- rspec-mocks (3.13.2)
61
+ rspec-mocks (3.13.8)
62
62
  diff-lcs (>= 1.2.0, < 2.0)
63
63
  rspec-support (~> 3.13.0)
64
- rspec-support (3.13.2)
65
- rubocop (1.75.2)
66
- json (~> 2.3)
64
+ rspec-support (3.13.7)
65
+ rubocop (1.92.2)
66
+ json (>= 2.3)
67
67
  language_server-protocol (~> 3.17.0.2)
68
68
  lint_roller (~> 1.1.0)
69
- parallel (~> 1.10)
69
+ parallel (>= 1.10)
70
70
  parser (>= 3.3.0.2)
71
71
  rainbow (>= 2.2.2, < 4.0)
72
- regexp_parser (>= 2.9.3, < 3.0)
73
- rubocop-ast (>= 1.44.0, < 2.0)
72
+ regexp_parser (>= 2.11.3, < 3.0)
73
+ rubocop-ast (>= 1.49.0, < 2.0)
74
74
  ruby-progressbar (~> 1.7)
75
75
  unicode-display_width (>= 2.4.0, < 4.0)
76
- rubocop-ast (1.44.0)
76
+ rubocop-ast (1.50.0)
77
77
  parser (>= 3.3.7.2)
78
- prism (~> 1.4)
79
- rubocop-performance (1.25.0)
78
+ prism (~> 1.7)
79
+ rubocop-performance (1.27.0)
80
80
  lint_roller (~> 1.1)
81
- rubocop (>= 1.75.0, < 2.0)
82
- rubocop-ast (>= 1.38.0, < 2.0)
83
- rubocop-rails (2.31.0)
81
+ rubocop (>= 1.89.0, < 2.0)
82
+ rubocop-ast (>= 1.47.1, < 2.0)
83
+ rubocop-rails (2.38.0)
84
84
  activesupport (>= 4.2.0)
85
85
  lint_roller (~> 1.1)
86
86
  rack (>= 1.1)
87
- rubocop (>= 1.75.0, < 2.0)
88
- rubocop-ast (>= 1.38.0, < 2.0)
87
+ rubocop (>= 1.89.0, < 2.0)
88
+ rubocop-ast (>= 1.44.0, < 2.0)
89
89
  rubocop-rake (0.7.1)
90
90
  lint_roller (~> 1.1)
91
91
  rubocop (>= 1.72.1)
92
- rubocop-rspec (3.5.0)
92
+ rubocop-rspec (3.10.2)
93
93
  lint_roller (~> 1.1)
94
- rubocop (~> 1.72, >= 1.72.1)
94
+ regexp_parser (>= 2.0)
95
+ rubocop (~> 1.86, >= 1.86.2)
95
96
  ruby-progressbar (1.13.0)
96
- securerandom (0.3.2)
97
- sevencop (0.47.0)
97
+ securerandom (0.4.1)
98
+ sevencop (0.48.1)
98
99
  activesupport
99
- rubocop
100
+ lint_roller (>= 1.1)
101
+ rubocop (>= 1.72.1)
100
102
  tzinfo (2.0.6)
101
103
  concurrent-ruby (~> 1.0)
102
- unicode-display_width (3.1.4)
103
- unicode-emoji (~> 4.0, >= 4.0.4)
104
- unicode-emoji (4.0.4)
104
+ unicode-display_width (3.3.0)
105
+ unicode-emoji (~> 4.3)
106
+ unicode-emoji (4.3.0)
107
+ uri (1.1.2)
105
108
 
106
109
  PLATFORMS
107
110
  ruby
@@ -117,4 +120,4 @@ DEPENDENCIES
117
120
  sevencop
118
121
 
119
122
  BUNDLED WITH
120
- 2.3.23
123
+ 2.5.22
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # rubocop-migration
2
2
 
3
- [![ci](https://github.com/r7kamura/rubocop-migration/actions/workflows/ci.yml/badge.svg)](https://github.com/r7kamura/rubocop-migration/actions/workflows/ci.yml)
4
-
5
3
  RuboCop plugin for ActiveRecord migration.
6
4
 
7
5
  ## Usage
@@ -10,7 +8,7 @@ Install `rubocop-migration` gem:
10
8
 
11
9
  ```ruby
12
10
  # Gemfile
13
- gem 'rubocop-migration', require: false
11
+ gem 'rubocop-migration'
14
12
  ```
15
13
 
16
14
  then add `rubocop-migration` to plugins section:
data/config/default.yml CHANGED
@@ -134,7 +134,7 @@ Migration/RenameColumn:
134
134
 
135
135
  Migration/RenameTable:
136
136
  Description: |
137
- Avoid removing tables that are in use.
137
+ Avoid renaming tables that are in use.
138
138
  Enabled: false
139
139
  Safe: false
140
140
  VersionAdded: '0.22'
@@ -170,6 +170,7 @@ module RuboCop
170
170
  )
171
171
  Parser.call(
172
172
  content: content,
173
+ parser_engine: respond_to?(:parser_engine) ? parser_engine : :parser_whitequark,
173
174
  path: path,
174
175
  target_ruby_version: target_ruby_version
175
176
  )
@@ -184,16 +185,19 @@ module RuboCop
184
185
  class Parser
185
186
  class << self
186
187
  # @param content [String]
188
+ # @param parser_engine [Symbol]
187
189
  # @param path [String]
188
190
  # @param target_ruby_version [#to_s]
189
191
  # @return [RuboCop::AST::Node]
190
192
  def call(
191
193
  content:,
194
+ parser_engine:,
192
195
  path:,
193
196
  target_ruby_version:
194
197
  )
195
198
  new(
196
199
  content: content,
200
+ parser_engine: parser_engine,
197
201
  path: path,
198
202
  target_ruby_version: target_ruby_version
199
203
  ).call
@@ -201,50 +205,29 @@ module RuboCop
201
205
  end
202
206
 
203
207
  # @param content [String]
208
+ # @param parser_engine [Symbol]
204
209
  # @param path [String]
205
210
  # @param target_ruby_version [#to_s]
206
211
  def initialize(
207
212
  content:,
213
+ parser_engine:,
208
214
  path:,
209
215
  target_ruby_version:
210
216
  )
211
217
  @content = content
218
+ @parser_engine = parser_engine
212
219
  @path = path
213
220
  @target_ruby_version = target_ruby_version
214
221
  end
215
222
 
216
223
  # @return [RuboCop::AST::Node]
217
224
  def call
218
- parser.parse(buffer)
219
- end
220
-
221
- private
222
-
223
- # @return [Parser::Source::Buffer]
224
- def buffer
225
- ::Parser::Source::Buffer.new(
225
+ ::RuboCop::ProcessedSource.new(
226
+ @content,
227
+ @target_ruby_version,
226
228
  @path,
227
- source: @content
228
- )
229
- end
230
-
231
- # @return [RuboCop::AST::Builder]
232
- def builder
233
- ::RuboCop::AST::Builder.new
234
- end
235
-
236
- def parser
237
- parser_class.new(builder)
238
- end
239
-
240
- # @return [Class]
241
- def parser_class
242
- ::Parser.const_get(parser_class_name)
243
- end
244
-
245
- # @return [String]
246
- def parser_class_name
247
- "Ruby#{@target_ruby_version.to_s.delete('.')}"
229
+ parser_engine: @parser_engine
230
+ ).ast
248
231
  end
249
232
  end
250
233
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'set'
4
-
5
3
  module RuboCop
6
4
  module Cop
7
5
  module Migration
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Migration
5
- VERSION = '0.7.0'
5
+ VERSION = '0.8.0'
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'RuboCop plugin for ActiveRecord migration.'
12
12
  spec.homepage = 'https://github.com/r7kamura/rubocop-migration'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = '>= 2.7'
14
+ spec.required_ruby_version = '>= 3.3'
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = spec.homepage
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-04-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -66,7 +65,6 @@ dependencies:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
67
  version: '2.24'
69
- description:
70
68
  email:
71
69
  - r7kamura@gmail.com
72
70
  executables: []
@@ -117,7 +115,6 @@ metadata:
117
115
  source_code_uri: https://github.com/r7kamura/rubocop-migration
118
116
  changelog_uri: https://github.com/r7kamura/rubocop-migration/releases
119
117
  default_lint_roller_plugin: RuboCop::Migration::Plugin
120
- post_install_message:
121
118
  rdoc_options: []
122
119
  require_paths:
123
120
  - lib
@@ -125,15 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
122
  requirements:
126
123
  - - ">="
127
124
  - !ruby/object:Gem::Version
128
- version: '2.7'
125
+ version: '3.3'
129
126
  required_rubygems_version: !ruby/object:Gem::Requirement
130
127
  requirements:
131
128
  - - ">="
132
129
  - !ruby/object:Gem::Version
133
130
  version: '0'
134
131
  requirements: []
135
- rubygems_version: 3.3.27
136
- signing_key:
132
+ rubygems_version: 4.0.20
137
133
  specification_version: 4
138
134
  summary: RuboCop plugin for ActiveRecord migration.
139
135
  test_files: []