rubocop-migration 0.6.0 → 0.7.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 +4 -4
- data/.rubocop.yml +5 -3
- data/Gemfile.lock +67 -63
- data/README.md +3 -3
- data/lib/rubocop/cop/migration/add_check_constraint.rb +1 -0
- data/lib/rubocop/cop/migration/add_column_with_default_value.rb +1 -0
- data/lib/rubocop/cop/migration/add_foreign_key.rb +1 -0
- data/lib/rubocop/cop/migration/add_index_columns_count.rb +1 -0
- data/lib/rubocop/cop/migration/add_index_concurrently.rb +1 -0
- data/lib/rubocop/cop/migration/add_index_duplicate.rb +2 -1
- data/lib/rubocop/cop/migration/batch_in_batches.rb +1 -0
- data/lib/rubocop/cop/migration/batch_in_transaction.rb +1 -0
- data/lib/rubocop/cop/migration/batch_with_throttling.rb +1 -0
- data/lib/rubocop/cop/migration/change_column.rb +1 -0
- data/lib/rubocop/cop/migration/change_column_null.rb +2 -1
- data/lib/rubocop/cop/migration/create_table_force.rb +1 -0
- data/lib/rubocop/cop/migration/jsonb.rb +1 -0
- data/lib/rubocop/cop/migration/remove_column.rb +1 -0
- data/lib/rubocop/cop/migration/rename_column.rb +1 -0
- data/lib/rubocop/cop/migration/rename_table.rb +1 -0
- data/lib/rubocop/cop/migration/reserved_word_mysql.rb +1 -0
- data/lib/rubocop/migration/plugin.rb +30 -0
- data/lib/rubocop/migration/version.rb +2 -2
- data/lib/rubocop/migration.rb +1 -1
- data/rubocop-migration.gemspec +5 -3
- metadata +22 -7
- data/lib/rubocop/migration/rubocop_extension.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0022087bc8e99cf2bc4e2f3baedb7b2b0ad587ff426f9bcd340646553662c866'
|
4
|
+
data.tar.gz: ce12e03910ea987ce6a38b809e30e62a37ce22faf0d9ab6c48c0fb4d3b482e5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 536056846d52490c2fdebbedafb3e4db06704a3f18bb6c1bcf7fbcb9f85e19bc3385f0911fb9358a26bbf4e2c0d56338fd5790821b7881297c51dd73fb9c3356
|
7
|
+
data.tar.gz: 6c4b6f308b59b2cfcf50cde30072d848f5c5656cba79f0b2248b02a5ef2daf169d9f76d92090ac6e18284f4803a20bd38c80258fc3693254e0a1c9051fbf8114
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,103 +1,107 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-migration (0.
|
4
|
+
rubocop-migration (0.7.0)
|
5
5
|
activesupport
|
6
|
-
|
6
|
+
lint_roller (>= 1.1)
|
7
|
+
rubocop (>= 1.72.1)
|
7
8
|
rubocop-rails (>= 2.24)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
activesupport (7.1.
|
13
|
+
activesupport (7.1.5.1)
|
13
14
|
base64
|
15
|
+
benchmark (>= 0.3)
|
14
16
|
bigdecimal
|
15
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
18
|
connection_pool (>= 2.2.5)
|
17
19
|
drb
|
18
20
|
i18n (>= 1.6, < 2)
|
21
|
+
logger (>= 1.4.2)
|
19
22
|
minitest (>= 5.1)
|
20
23
|
mutex_m
|
24
|
+
securerandom (>= 0.3)
|
21
25
|
tzinfo (~> 2.0)
|
22
|
-
ast (2.4.
|
26
|
+
ast (2.4.3)
|
23
27
|
base64 (0.2.0)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
i18n (1.14.
|
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)
|
31
35
|
concurrent-ruby (~> 1.0)
|
32
|
-
json (2.
|
33
|
-
language_server-protocol (3.17.0.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
json (2.10.2)
|
37
|
+
language_server-protocol (3.17.0.4)
|
38
|
+
lint_roller (1.1.0)
|
39
|
+
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)
|
38
44
|
ast (~> 2.4.1)
|
39
45
|
racc
|
40
|
-
|
41
|
-
|
46
|
+
prism (1.4.0)
|
47
|
+
racc (1.8.1)
|
48
|
+
rack (3.1.12)
|
42
49
|
rainbow (3.1.1)
|
43
|
-
rake (13.1
|
44
|
-
regexp_parser (2.
|
45
|
-
|
46
|
-
|
47
|
-
rspec-
|
48
|
-
rspec-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
rspec-expectations (3.12.3)
|
50
|
+
rake (13.2.1)
|
51
|
+
regexp_parser (2.10.0)
|
52
|
+
rspec (3.13.0)
|
53
|
+
rspec-core (~> 3.13.0)
|
54
|
+
rspec-expectations (~> 3.13.0)
|
55
|
+
rspec-mocks (~> 3.13.0)
|
56
|
+
rspec-core (3.13.3)
|
57
|
+
rspec-support (~> 3.13.0)
|
58
|
+
rspec-expectations (3.13.3)
|
53
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-mocks (3.
|
60
|
+
rspec-support (~> 3.13.0)
|
61
|
+
rspec-mocks (3.13.2)
|
56
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
-
rspec-support (~> 3.
|
58
|
-
rspec-support (3.
|
59
|
-
rubocop (1.
|
63
|
+
rspec-support (~> 3.13.0)
|
64
|
+
rspec-support (3.13.2)
|
65
|
+
rubocop (1.75.2)
|
60
66
|
json (~> 2.3)
|
61
|
-
language_server-protocol (
|
67
|
+
language_server-protocol (~> 3.17.0.2)
|
68
|
+
lint_roller (~> 1.1.0)
|
62
69
|
parallel (~> 1.10)
|
63
70
|
parser (>= 3.3.0.2)
|
64
71
|
rainbow (>= 2.2.2, < 4.0)
|
65
|
-
regexp_parser (>=
|
66
|
-
|
67
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
72
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
73
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
68
74
|
ruby-progressbar (~> 1.7)
|
69
|
-
unicode-display_width (>= 2.4.0, <
|
70
|
-
rubocop-ast (1.
|
71
|
-
parser (>= 3.3.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
rubocop (
|
76
|
-
|
77
|
-
|
78
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
79
|
-
rubocop-rails (2.29.1)
|
75
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
76
|
+
rubocop-ast (1.44.0)
|
77
|
+
parser (>= 3.3.7.2)
|
78
|
+
prism (~> 1.4)
|
79
|
+
rubocop-performance (1.25.0)
|
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)
|
80
84
|
activesupport (>= 4.2.0)
|
85
|
+
lint_roller (~> 1.1)
|
81
86
|
rack (>= 1.1)
|
82
|
-
rubocop (>= 1.
|
83
|
-
rubocop-ast (>= 1.
|
84
|
-
rubocop-rake (0.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
rubocop
|
90
|
-
rubocop-rspec_rails (~> 2.28)
|
91
|
-
rubocop-rspec_rails (2.28.3)
|
92
|
-
rubocop (~> 1.40)
|
87
|
+
rubocop (>= 1.75.0, < 2.0)
|
88
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
89
|
+
rubocop-rake (0.7.1)
|
90
|
+
lint_roller (~> 1.1)
|
91
|
+
rubocop (>= 1.72.1)
|
92
|
+
rubocop-rspec (3.5.0)
|
93
|
+
lint_roller (~> 1.1)
|
94
|
+
rubocop (~> 1.72, >= 1.72.1)
|
93
95
|
ruby-progressbar (1.13.0)
|
94
|
-
|
95
|
-
sevencop (0.
|
96
|
+
securerandom (0.3.2)
|
97
|
+
sevencop (0.47.0)
|
96
98
|
activesupport
|
97
99
|
rubocop
|
98
100
|
tzinfo (2.0.6)
|
99
101
|
concurrent-ruby (~> 1.0)
|
100
|
-
unicode-display_width (
|
102
|
+
unicode-display_width (3.1.4)
|
103
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
104
|
+
unicode-emoji (4.0.4)
|
101
105
|
|
102
106
|
PLATFORMS
|
103
107
|
ruby
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://github.com/r7kamura/rubocop-migration/actions/workflows/ci.yml)
|
4
4
|
|
5
|
-
RuboCop
|
5
|
+
RuboCop plugin for ActiveRecord migration.
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
@@ -13,11 +13,11 @@ Install `rubocop-migration` gem:
|
|
13
13
|
gem 'rubocop-migration', require: false
|
14
14
|
```
|
15
15
|
|
16
|
-
then
|
16
|
+
then add `rubocop-migration` to plugins section:
|
17
17
|
|
18
18
|
```yaml
|
19
19
|
# .rubocop.yml
|
20
|
-
|
20
|
+
plugins:
|
21
21
|
- rubocop-migration
|
22
22
|
|
23
23
|
Migration/AddCheckConstraint:
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
# Avoid adding duplicate indexes.
|
10
10
|
#
|
11
11
|
# @safety
|
12
|
-
# This cop tries to find existing indexes from db/schema.rb, but it
|
12
|
+
# This cop tries to find existing indexes from db/schema.rb, but it cannot be found.
|
13
13
|
#
|
14
14
|
# @example
|
15
15
|
# # bad
|
@@ -39,6 +39,7 @@ module RuboCop
|
|
39
39
|
|
40
40
|
add_offense(node)
|
41
41
|
end
|
42
|
+
alias on_csend on_send
|
42
43
|
|
43
44
|
private
|
44
45
|
|
@@ -52,6 +52,7 @@ module RuboCop
|
|
52
52
|
autocorrect(corrector, node)
|
53
53
|
end
|
54
54
|
end
|
55
|
+
alias on_csend on_send
|
55
56
|
|
56
57
|
private
|
57
58
|
|
@@ -144,7 +145,7 @@ module RuboCop
|
|
144
145
|
node.first_argument.value.to_s
|
145
146
|
end
|
146
147
|
|
147
|
-
# @
|
148
|
+
# @param node [RuboCop::AST::SendNode]
|
148
149
|
# @return [String]
|
149
150
|
def find_table_name_from_change_column_null(node)
|
150
151
|
node.first_argument.value.to_s
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Migration
|
7
|
+
class Plugin < ::LintRoller::Plugin
|
8
|
+
def about
|
9
|
+
::LintRoller::About.new(
|
10
|
+
description: 'RuboCop plugin for ActiveRecord migration.',
|
11
|
+
homepage: 'https://github.com/r7kamura/rubocop-migration',
|
12
|
+
name: 'rubocop-migration',
|
13
|
+
version: VERSION
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def rules(_context)
|
18
|
+
::LintRoller::Rules.new(
|
19
|
+
config_format: :rubocop,
|
20
|
+
type: :path,
|
21
|
+
value: "#{__dir__}/../../../config/default.yml"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def supported?(context)
|
26
|
+
context.engine == :rubocop
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/rubocop/migration.rb
CHANGED
data/rubocop-migration.gemspec
CHANGED
@@ -4,11 +4,11 @@ require_relative 'lib/rubocop/migration/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'rubocop-migration'
|
7
|
-
spec.version =
|
7
|
+
spec.version = RuboCop::Migration::VERSION
|
8
8
|
spec.authors = ['Ryo Nakamura']
|
9
9
|
spec.email = ['r7kamura@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = 'RuboCop
|
11
|
+
spec.summary = 'RuboCop plugin for ActiveRecord migration.'
|
12
12
|
spec.homepage = 'https://github.com/r7kamura/rubocop-migration'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
spec.required_ruby_version = '>= 2.7'
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
17
|
spec.metadata['source_code_uri'] = spec.homepage
|
18
18
|
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
|
19
|
+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::Migration::Plugin'
|
19
20
|
|
20
21
|
spec.files = Dir.chdir(__dir__) do
|
21
22
|
`git ls-files -z`.split("\x0").reject do |f|
|
@@ -27,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
27
28
|
spec.require_paths = ['lib']
|
28
29
|
|
29
30
|
spec.add_dependency 'activesupport'
|
30
|
-
spec.add_dependency '
|
31
|
+
spec.add_dependency 'lint_roller', '>= 1.1'
|
32
|
+
spec.add_dependency 'rubocop', '>= 1.72.1'
|
31
33
|
spec.add_dependency 'rubocop-rails', '>= 2.24'
|
32
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,20 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: lint_roller
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: 1.72.1
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 1.72.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rubocop-rails
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,7 +106,7 @@ files:
|
|
92
106
|
- lib/rubocop/migration/cop_concerns/batch_processing.rb
|
93
107
|
- lib/rubocop/migration/cop_concerns/column_type_method.rb
|
94
108
|
- lib/rubocop/migration/cop_concerns/disable_ddl_transaction.rb
|
95
|
-
- lib/rubocop/migration/
|
109
|
+
- lib/rubocop/migration/plugin.rb
|
96
110
|
- lib/rubocop/migration/version.rb
|
97
111
|
- rubocop-migration.gemspec
|
98
112
|
homepage: https://github.com/r7kamura/rubocop-migration
|
@@ -102,6 +116,7 @@ metadata:
|
|
102
116
|
homepage_uri: https://github.com/r7kamura/rubocop-migration
|
103
117
|
source_code_uri: https://github.com/r7kamura/rubocop-migration
|
104
118
|
changelog_uri: https://github.com/r7kamura/rubocop-migration/releases
|
119
|
+
default_lint_roller_plugin: RuboCop::Migration::Plugin
|
105
120
|
post_install_message:
|
106
121
|
rdoc_options: []
|
107
122
|
require_paths:
|
@@ -117,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
132
|
- !ruby/object:Gem::Version
|
118
133
|
version: '0'
|
119
134
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.3.27
|
121
136
|
signing_key:
|
122
137
|
specification_version: 4
|
123
|
-
summary: RuboCop
|
138
|
+
summary: RuboCop plugin for ActiveRecord migration.
|
124
139
|
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubocop'
|
4
|
-
|
5
|
-
require_relative 'config_loader'
|
6
|
-
|
7
|
-
RuboCop::ConfigLoader.instance_variable_set(
|
8
|
-
:@default_configuration,
|
9
|
-
RuboCop::Migration::ConfigLoader.call(
|
10
|
-
path: File.expand_path(
|
11
|
-
'../../../config/default.yml',
|
12
|
-
__dir__
|
13
|
-
)
|
14
|
-
)
|
15
|
-
)
|