rbs_active_hash 1.5.0 → 1.6.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: 885515470d42b99892b06b8e302a0a92085f1cb048d46c8b0f5b95ea2bc2f03c
4
- data.tar.gz: 804a6904837b2d14b0ba529f9060342c231c58d624153ab53ecb2ac07153841b
3
+ metadata.gz: c72503e55cdd29dfb738e4cf1154b5673de210dabcb9c987770020f6421b37fb
4
+ data.tar.gz: 3f8b643bf0c6febc8d74b9139dc7db95a40feba1976c4213634ab4ba3e2c53cb
5
5
  SHA512:
6
- metadata.gz: 0751c6dd849f3edfe89f741cf271d71ffd43309d9dce4b1f956bf4b0c82f910e70032e3a97857cb25d41c5fd5e5ea8ba62e8cfa280e1fee23278f1486a159f71
7
- data.tar.gz: 6ce51db140684cda4156200a1e6fea5a0fd6efe2a522e7870ec432a6cfc5c5b06f3193295eba83aea1dadb204b939c4bcb3afdae239308751fade4d169f2de38
6
+ metadata.gz: 4ec043fdcc777e755c87b739a432e01769520f7eff3d9137dbe054c260c632def1bd5aa13b5cd81a29f95f960408caa6231f6db0ea77c430f92d63260ed90342
7
+ data.tar.gz: 6892cf7036260f002def3aeaf016529b40f401ec78e03e539ef5d61a7ad56a12d89c77901ba3b08f04e8cf33cb5c93fffbf7bddb248aaa2a5cfe891850ebe87f
data/.rubocop.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.2
3
+ NewCops: enable
4
+
5
+ plugins:
6
+ - rubocop-rake
7
+ - rubocop-rspec
3
8
 
4
9
  Style/Documentation:
5
10
  Enabled: false
@@ -12,6 +17,9 @@ Style/StringLiteralsInInterpolation:
12
17
  Enabled: true
13
18
  EnforcedStyle: double_quotes
14
19
 
20
+ Layout/LeadingCommentSpace:
21
+ AllowRBSInlineAnnotation: true
22
+
15
23
  Layout/LineLength:
16
24
  Max: 120
17
25
 
@@ -33,3 +41,9 @@ Metrics/MethodLength:
33
41
 
34
42
  Metrics/PerceivedComplexity:
35
43
  Max: 10
44
+
45
+ RSpec/NamedSubject:
46
+ Enabled: false
47
+
48
+ RSpec/MultipleExpectations:
49
+ Max: 10
@@ -2,8 +2,22 @@
2
2
  "[ruby]": {
3
3
  "editor.defaultFormatter": "Shopify.ruby-lsp"
4
4
  },
5
- "rbs-helper.signature-directory": "sig",
6
5
  "cSpell.words": [
7
- "Cyclomatic"
8
- ]
6
+ "activerecord",
7
+ "bindir",
8
+ "boolish",
9
+ "Colour",
10
+ "Cyclomatic",
11
+ "FCALL",
12
+ "klass",
13
+ "KOMIYA",
14
+ "raketask",
15
+ "rubocop",
16
+ "rubygems",
17
+ "Takeshi",
18
+ "tk0miya",
19
+ "VCALL"
20
+ ],
21
+ "rbs-helper.rbs-inline-signature-directory": "sig/",
22
+ "rbs-helper.rbs-inline-on-save": true
9
23
  }
data/Gemfile CHANGED
@@ -5,9 +5,11 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in rbs_active_hash.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.1"
8
+ gem "rake", "~> 13.3"
9
9
 
10
- gem "rubocop", "~> 1.60"
10
+ gem "rubocop", "~> 1.81"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
11
13
 
12
14
  group :test do
13
15
  gem "activerecord"
@@ -17,6 +19,7 @@ group :development do
17
19
  gem "rspec", require: false
18
20
  gem "rspec-daemon", require: false
19
21
 
22
+ gem "rbs-inline", require: false
20
23
  gem "steep"
21
24
  end
22
25
 
data/Gemfile.lock CHANGED
@@ -1,196 +1,227 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs_active_hash (1.5.0)
4
+ rbs_active_hash (1.6.0)
5
5
  active_hash
6
6
  rbs
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (7.1.3)
12
- actionview (= 7.1.3)
13
- activesupport (= 7.1.3)
11
+ actionpack (7.2.2.2)
12
+ actionview (= 7.2.2.2)
13
+ activesupport (= 7.2.2.2)
14
14
  nokogiri (>= 1.8.5)
15
15
  racc
16
- rack (>= 2.2.4)
16
+ rack (>= 2.2.4, < 3.2)
17
17
  rack-session (>= 1.0.1)
18
18
  rack-test (>= 0.6.3)
19
19
  rails-dom-testing (~> 2.2)
20
20
  rails-html-sanitizer (~> 1.6)
21
- actionview (7.1.3)
22
- activesupport (= 7.1.3)
21
+ useragent (~> 0.16)
22
+ actionview (7.2.2.2)
23
+ activesupport (= 7.2.2.2)
23
24
  builder (~> 3.1)
24
25
  erubi (~> 1.11)
25
26
  rails-dom-testing (~> 2.2)
26
27
  rails-html-sanitizer (~> 1.6)
27
- active_hash (3.2.1)
28
- activesupport (>= 5.0.0)
29
- activemodel (7.1.3)
30
- activesupport (= 7.1.3)
31
- activerecord (7.1.3)
32
- activemodel (= 7.1.3)
33
- activesupport (= 7.1.3)
28
+ active_hash (4.0.0)
29
+ activesupport (>= 6.1.0)
30
+ activemodel (7.2.2.2)
31
+ activesupport (= 7.2.2.2)
32
+ activerecord (7.2.2.2)
33
+ activemodel (= 7.2.2.2)
34
+ activesupport (= 7.2.2.2)
34
35
  timeout (>= 0.4.0)
35
- activesupport (7.1.3)
36
+ activesupport (7.2.2.2)
36
37
  base64
38
+ benchmark (>= 0.3)
37
39
  bigdecimal
38
- concurrent-ruby (~> 1.0, >= 1.0.2)
40
+ concurrent-ruby (~> 1.0, >= 1.3.1)
39
41
  connection_pool (>= 2.2.5)
40
42
  drb
41
43
  i18n (>= 1.6, < 2)
44
+ logger (>= 1.4.2)
42
45
  minitest (>= 5.1)
43
- mutex_m
44
- tzinfo (~> 2.0)
45
- ast (2.4.2)
46
- base64 (0.2.0)
47
- bigdecimal (3.1.6)
48
- builder (3.2.4)
49
- concurrent-ruby (1.2.3)
50
- connection_pool (2.4.1)
46
+ securerandom (>= 0.3)
47
+ tzinfo (~> 2.0, >= 2.0.5)
48
+ ast (2.4.3)
49
+ base64 (0.3.0)
50
+ benchmark (0.4.1)
51
+ bigdecimal (3.2.2)
52
+ builder (3.3.0)
53
+ concurrent-ruby (1.3.5)
54
+ connection_pool (2.5.3)
51
55
  crass (1.0.6)
52
- csv (3.2.7)
53
- diff-lcs (1.5.0)
54
- drb (2.2.0)
55
- ruby2_keywords
56
- erubi (1.12.0)
57
- ffi (1.15.5)
58
- fileutils (1.7.1)
59
- i18n (1.14.1)
56
+ csv (3.3.3)
57
+ date (3.4.1)
58
+ diff-lcs (1.6.2)
59
+ drb (2.2.3)
60
+ erubi (1.13.0)
61
+ ffi (1.17.1-arm64-darwin)
62
+ ffi (1.17.1-x86_64-darwin)
63
+ ffi (1.17.1-x86_64-linux-gnu)
64
+ fileutils (1.7.3)
65
+ i18n (1.14.7)
60
66
  concurrent-ruby (~> 1.0)
61
- io-console (0.7.2)
62
- irb (1.11.1)
63
- rdoc
67
+ io-console (0.8.0)
68
+ irb (1.14.2)
69
+ rdoc (>= 4.0.0)
64
70
  reline (>= 0.4.2)
65
- json (2.7.1)
66
- language_server-protocol (3.17.0.3)
67
- listen (3.8.0)
71
+ json (2.15.0)
72
+ language_server-protocol (3.17.0.5)
73
+ lint_roller (1.1.0)
74
+ listen (3.9.0)
68
75
  rb-fsevent (~> 0.10, >= 0.10.3)
69
76
  rb-inotify (~> 0.9, >= 0.9.10)
70
- logger (1.5.3)
71
- loofah (2.22.0)
77
+ logger (1.7.0)
78
+ loofah (2.23.1)
72
79
  crass (~> 1.0.2)
73
80
  nokogiri (>= 1.12.0)
74
- minitest (5.21.2)
75
- mutex_m (0.2.0)
76
- nokogiri (1.15.5-x86_64-darwin)
81
+ minitest (5.25.5)
82
+ mutex_m (0.3.0)
83
+ nokogiri (1.18.9-arm64-darwin)
84
+ racc (~> 1.4)
85
+ nokogiri (1.18.9-x86_64-darwin)
77
86
  racc (~> 1.4)
78
- nokogiri (1.15.5-x86_64-linux)
87
+ nokogiri (1.18.9-x86_64-linux-gnu)
79
88
  racc (~> 1.4)
80
- parallel (1.24.0)
81
- parser (3.3.0.5)
89
+ parallel (1.27.0)
90
+ parser (3.3.9.0)
82
91
  ast (~> 2.4.1)
83
92
  racc
84
- psych (5.1.2)
93
+ prism (1.5.1)
94
+ psych (5.2.1)
95
+ date
85
96
  stringio
86
- racc (1.7.3)
87
- rack (3.0.8)
88
- rack-session (2.0.0)
97
+ racc (1.8.1)
98
+ rack (3.1.16)
99
+ rack-session (2.1.1)
100
+ base64 (>= 0.1.0)
89
101
  rack (>= 3.0.0)
90
102
  rack-test (2.1.0)
91
103
  rack (>= 1.3)
92
- rackup (2.1.0)
104
+ rackup (2.2.1)
93
105
  rack (>= 3)
94
- webrick (~> 1.8)
95
106
  rails-dom-testing (2.2.0)
96
107
  activesupport (>= 5.0.0)
97
108
  minitest
98
109
  nokogiri (>= 1.6)
99
- rails-html-sanitizer (1.6.0)
110
+ rails-html-sanitizer (1.6.2)
100
111
  loofah (~> 2.21)
101
- nokogiri (~> 1.14)
102
- railties (7.1.3)
103
- actionpack (= 7.1.3)
104
- activesupport (= 7.1.3)
105
- irb
112
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
113
+ railties (7.2.2.2)
114
+ actionpack (= 7.2.2.2)
115
+ activesupport (= 7.2.2.2)
116
+ irb (~> 1.13)
106
117
  rackup (>= 1.0.0)
107
118
  rake (>= 12.2)
108
119
  thor (~> 1.0, >= 1.2.2)
109
120
  zeitwerk (~> 2.6)
110
121
  rainbow (3.1.1)
111
- rake (13.1.0)
122
+ rake (13.3.0)
112
123
  rb-fsevent (0.11.2)
113
- rb-inotify (0.10.1)
124
+ rb-inotify (0.11.1)
114
125
  ffi (~> 1.0)
115
- rbs (3.1.3)
116
- rdoc (6.6.2)
126
+ rbs (3.9.5)
127
+ logger
128
+ rbs-inline (0.12.0)
129
+ prism (>= 0.29)
130
+ rbs (>= 3.8.0)
131
+ rdoc (6.9.0)
117
132
  psych (>= 4.0.0)
118
- regexp_parser (2.9.0)
119
- reline (0.4.2)
133
+ regexp_parser (2.11.3)
134
+ reline (0.5.12)
120
135
  io-console (~> 0.5)
121
- rexml (3.2.6)
122
- rspec (3.12.0)
123
- rspec-core (~> 3.12.0)
124
- rspec-expectations (~> 3.12.0)
125
- rspec-mocks (~> 3.12.0)
126
- rspec-core (3.12.2)
127
- rspec-support (~> 3.12.0)
136
+ rspec (3.13.1)
137
+ rspec-core (~> 3.13.0)
138
+ rspec-expectations (~> 3.13.0)
139
+ rspec-mocks (~> 3.13.0)
140
+ rspec-core (3.13.4)
141
+ rspec-support (~> 3.13.0)
128
142
  rspec-daemon (1.1.1)
129
143
  rspec
130
- rspec-expectations (3.12.3)
144
+ rspec-expectations (3.13.5)
131
145
  diff-lcs (>= 1.2.0, < 2.0)
132
- rspec-support (~> 3.12.0)
133
- rspec-mocks (3.12.6)
146
+ rspec-support (~> 3.13.0)
147
+ rspec-mocks (3.13.5)
134
148
  diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.12.0)
136
- rspec-support (3.12.1)
137
- rubocop (1.60.2)
149
+ rspec-support (~> 3.13.0)
150
+ rspec-support (3.13.4)
151
+ rubocop (1.81.1)
138
152
  json (~> 2.3)
139
- language_server-protocol (>= 3.17.0)
153
+ language_server-protocol (~> 3.17.0.2)
154
+ lint_roller (~> 1.1.0)
140
155
  parallel (~> 1.10)
141
156
  parser (>= 3.3.0.2)
142
157
  rainbow (>= 2.2.2, < 4.0)
143
- regexp_parser (>= 1.8, < 3.0)
144
- rexml (>= 3.2.5, < 4.0)
145
- rubocop-ast (>= 1.30.0, < 2.0)
158
+ regexp_parser (>= 2.9.3, < 3.0)
159
+ rubocop-ast (>= 1.47.1, < 2.0)
146
160
  ruby-progressbar (~> 1.7)
147
- unicode-display_width (>= 2.4.0, < 3.0)
148
- rubocop-ast (1.30.0)
149
- parser (>= 3.2.1.0)
161
+ unicode-display_width (>= 2.4.0, < 4.0)
162
+ rubocop-ast (1.47.1)
163
+ parser (>= 3.3.7.2)
164
+ prism (~> 1.4)
165
+ rubocop-rake (0.7.1)
166
+ lint_roller (~> 1.1)
167
+ rubocop (>= 1.72.1)
168
+ rubocop-rspec (3.7.0)
169
+ lint_roller (~> 1.1)
170
+ rubocop (~> 1.72, >= 1.72.1)
150
171
  ruby-progressbar (1.13.0)
151
- ruby2_keywords (0.0.5)
152
- securerandom (0.2.2)
153
- steep (1.5.3)
172
+ securerandom (0.4.1)
173
+ steep (1.10.0)
154
174
  activesupport (>= 5.1)
155
175
  concurrent-ruby (>= 1.1.10)
156
176
  csv (>= 3.0.9)
157
177
  fileutils (>= 1.1.0)
158
178
  json (>= 2.1.0)
159
- language_server-protocol (>= 3.15, < 4.0)
179
+ language_server-protocol (>= 3.17.0.4, < 4.0)
160
180
  listen (~> 3.0)
161
181
  logger (>= 1.3.0)
182
+ mutex_m (>= 0.3.0)
162
183
  parser (>= 3.1)
163
184
  rainbow (>= 2.2.2, < 4.0)
164
- rbs (>= 3.1.0)
185
+ rbs (~> 3.9)
165
186
  securerandom (>= 0.1)
166
187
  strscan (>= 1.0.0)
167
- terminal-table (>= 2, < 4)
168
- stringio (3.1.0)
169
- strscan (3.0.6)
170
- terminal-table (3.0.2)
171
- unicode-display_width (>= 1.1.1, < 3)
172
- thor (1.3.0)
173
- timeout (0.4.1)
188
+ terminal-table (>= 2, < 5)
189
+ uri (>= 0.12.0)
190
+ stringio (3.1.2)
191
+ strscan (3.1.2)
192
+ terminal-table (4.0.0)
193
+ unicode-display_width (>= 1.1.1, < 4)
194
+ thor (1.3.2)
195
+ timeout (0.4.3)
174
196
  tzinfo (2.0.6)
175
197
  concurrent-ruby (~> 1.0)
176
- unicode-display_width (2.5.0)
177
- webrick (1.8.1)
178
- zeitwerk (2.6.12)
198
+ unicode-display_width (3.2.0)
199
+ unicode-emoji (~> 4.1)
200
+ unicode-emoji (4.1.0)
201
+ uri (1.0.3)
202
+ useragent (0.16.11)
203
+ zeitwerk (2.6.18)
179
204
 
180
205
  PLATFORMS
206
+ arm64-darwin-24
181
207
  x86_64-darwin-19
182
208
  x86_64-darwin-21
209
+ x86_64-darwin-23
210
+ x86_64-darwin-24
183
211
  x86_64-linux
184
212
 
185
213
  DEPENDENCIES
186
214
  activerecord
187
215
  railties
188
- rake (~> 13.1)
216
+ rake (~> 13.3)
217
+ rbs-inline
189
218
  rbs_active_hash!
190
219
  rspec
191
220
  rspec-daemon
192
- rubocop (~> 1.60)
221
+ rubocop (~> 1.81)
222
+ rubocop-rake
223
+ rubocop-rspec
193
224
  steep
194
225
 
195
226
  BUNDLED WITH
196
- 2.4.4
227
+ 2.3.27
data/Steepfile CHANGED
@@ -8,4 +8,5 @@ target :lib do
8
8
  check "lib"
9
9
 
10
10
  configure_code_diagnostics(D::Ruby.lenient)
11
+ implicitly_returns_nil!
11
12
  end
@@ -4,7 +4,7 @@ require "rails"
4
4
 
5
5
  module RbsActiveHash
6
6
  class InstallGenerator < Rails::Generators::Base
7
- def create_raketask
7
+ def create_raketask #: void
8
8
  create_file "lib/tasks/rbs_active_hash.rake", <<~RUBY
9
9
  # frozen_string_literal: true
10
10
 
@@ -12,6 +12,7 @@ module RbsActiveHash
12
12
  end
13
13
 
14
14
  class RB < RBS::Prototype::RB
15
+ # @rbs override
15
16
  def process(node, decls:, comments:, context:)
16
17
  case node.type
17
18
  when :FCALL, :VCALL
@@ -42,16 +43,21 @@ module RbsActiveHash
42
43
  end
43
44
 
44
45
  class Parser
45
- attr_reader :has_many, :has_one, :belongs_to, :scopes
46
+ attr_reader :has_many #: Array[[Symbol, Hash[untyped, untyped]]]
47
+ attr_reader :has_one #: Array[[Symbol, Hash[untyped, untyped]]]
48
+ attr_reader :belongs_to #: Array[[Symbol, Hash[untyped, untyped]]]
49
+ attr_reader :scopes #: Array[[Symbol, Hash[untyped, untyped]]]
46
50
 
47
- def initialize
51
+ def initialize #: void
48
52
  @has_many = []
49
53
  @has_one = []
50
54
  @belongs_to = []
51
55
  @scopes = []
52
56
  end
53
57
 
54
- def parse(string, target)
58
+ # @rbs string: String
59
+ # @rbs target: Array[Symbol]
60
+ def parse(string, target) #: void
55
61
  parser = RB.new
56
62
  parser.parse(string)
57
63
  parser.decls.each do |decl|
@@ -59,7 +65,9 @@ module RbsActiveHash
59
65
  end
60
66
  end
61
67
 
62
- def process(node, target)
68
+ # @rbs node: RBS::AST::Declarations::t | RBS::AST::Members::t
69
+ # @rbs target: Array[Symbol]
70
+ def process(node, target) #: void
63
71
  case node
64
72
  when RBS::AST::Declarations::Module, RBS::AST::Declarations::Class
65
73
  name = node.name.split
@@ -75,7 +83,8 @@ module RbsActiveHash
75
83
  end
76
84
  end
77
85
 
78
- def process_association_definition(node)
86
+ # @rbs node: AssociationDefinition
87
+ def process_association_definition(node) #: void
79
88
  case node.name.name
80
89
  when :has_many
81
90
  association_id, args = node_to_literal(node.args)
@@ -89,16 +98,18 @@ module RbsActiveHash
89
98
  end
90
99
  end
91
100
 
92
- def process_scope_definition(node)
101
+ # @rbs node: ScopeDefinition
102
+ def process_scope_definition(node) #: void
93
103
  scope_id, args = node_to_literal(node.args)
94
104
  @scopes << [scope_id, args]
95
105
  end
96
106
 
97
- def node_to_literal(node)
107
+ # @rbs node: untyped
108
+ def node_to_literal(node) #: untyped
98
109
  case node.type
99
110
  when :LIST
100
111
  node.children[...-1].map { |child| node_to_literal(child) }
101
- when :LIT, :STR
112
+ when :LIT, :STR, :SYM
102
113
  node.children.first
103
114
  when :HASH
104
115
  Hash[*node_to_literal(node.children.first)]