rbs_heuristic_prototype 0.2.0 → 0.4.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: 2ee5a4a5f00977d9e0dbc066729d092cec68269d386873fc3f5f54a916c307c9
4
- data.tar.gz: 2418855e5847a4acaba0a3f03f9154126ab26026168a70764a3e30bec74d38fa
3
+ metadata.gz: af9a660bde45e0c64701f350cfa2fed63112aec3c6fd3320f0387b084c5a6236
4
+ data.tar.gz: 92f823a5423774c78a092b35719ec66d440e9d63dedc5488d07c7049fd3b03df
5
5
  SHA512:
6
- metadata.gz: b50cbc5fdbef39926001a9a6ca9c4844a62985a4f1827d69bc03f4963059875ce48a1c235fc15d5f9d3479475903225dbf74f63bd4448d024ad69c007e1ff68e
7
- data.tar.gz: 8d7c8d7b4a71c9574cd31b65359548fdad6e7782d00e675352a4ff77ec268bcf8ff864dd47f900783a4f575b8745148cc412916b793413f326822f1d57b92902
6
+ metadata.gz: e0dce9def43b5ccd0445b2f4d748626381bf83eeb9831082b9bd184d49f7cc0a0c039c16a3dda9df2ae7bb595a056e2b39551c13dbc8b74a91dcbd54f474732d
7
+ data.tar.gz: 9d7aeaa4971e0b3535e94abb963dde4ad11528c8601a770ddae778fa4adde37a0bca5c4b7dda2088fe651ebf0ecd9dae843df4ea02aa00a97fd7824cc4c6417d
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.1
2
+ TargetRubyVersion: 2.7
3
3
 
4
4
  Style/Documentation:
5
5
  Enabled: false
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gemspec
8
8
  gem "activerecord"
9
9
  gem "railties"
10
10
  gem "rake", "~> 13.0"
11
- gem "rubocop", "~> 1.54"
11
+ gem "rubocop", "~> 1.55"
12
12
 
13
13
  group :development do
14
14
  gem "rspec", require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs_heuristic_prototype (0.2.0)
4
+ rbs_heuristic_prototype (0.4.0)
5
5
  rbs
6
6
 
7
7
  GEM
@@ -52,7 +52,7 @@ GEM
52
52
  crass (~> 1.0.2)
53
53
  nokogiri (>= 1.12.0)
54
54
  method_source (1.0.0)
55
- minitest (5.18.1)
55
+ minitest (5.19.0)
56
56
  nokogiri (1.15.2-x86_64-darwin)
57
57
  racc (~> 1.4)
58
58
  nokogiri (1.15.2-x86_64-linux)
@@ -87,9 +87,9 @@ GEM
87
87
  rb-fsevent (0.11.2)
88
88
  rb-inotify (0.10.1)
89
89
  ffi (~> 1.0)
90
- rbs (3.1.0)
90
+ rbs (3.1.2)
91
91
  regexp_parser (2.8.1)
92
- rexml (3.2.5)
92
+ rexml (3.2.6)
93
93
  rspec (3.12.0)
94
94
  rspec-core (~> 3.12.0)
95
95
  rspec-expectations (~> 3.12.0)
@@ -106,7 +106,7 @@ GEM
106
106
  diff-lcs (>= 1.2.0, < 2.0)
107
107
  rspec-support (~> 3.12.0)
108
108
  rspec-support (3.12.0)
109
- rubocop (1.54.2)
109
+ rubocop (1.55.0)
110
110
  json (~> 2.3)
111
111
  language_server-protocol (>= 3.17.0)
112
112
  parallel (~> 1.10)
@@ -114,14 +114,14 @@ GEM
114
114
  rainbow (>= 2.2.2, < 4.0)
115
115
  regexp_parser (>= 1.8, < 3.0)
116
116
  rexml (>= 3.2.5, < 4.0)
117
- rubocop-ast (>= 1.28.0, < 2.0)
117
+ rubocop-ast (>= 1.28.1, < 2.0)
118
118
  ruby-progressbar (~> 1.7)
119
119
  unicode-display_width (>= 2.4.0, < 3.0)
120
120
  rubocop-ast (1.29.0)
121
121
  parser (>= 3.2.1.0)
122
122
  ruby-progressbar (1.13.0)
123
123
  securerandom (0.2.2)
124
- steep (1.5.0)
124
+ steep (1.5.2)
125
125
  activesupport (>= 5.1)
126
126
  concurrent-ruby (>= 1.1.10)
127
127
  csv (>= 3.0.9)
@@ -146,6 +146,7 @@ GEM
146
146
  zeitwerk (2.6.8)
147
147
 
148
148
  PLATFORMS
149
+ x86_64-darwin-19
149
150
  x86_64-darwin-21
150
151
  x86_64-linux
151
152
 
@@ -156,8 +157,8 @@ DEPENDENCIES
156
157
  rbs_heuristic_prototype!
157
158
  rspec
158
159
  rspec-daemon
159
- rubocop (~> 1.54)
160
+ rubocop (~> 1.55)
160
161
  steep
161
162
 
162
163
  BUNDLED WITH
163
- 2.4.13
164
+ 2.3.12
data/README.md CHANGED
@@ -41,6 +41,8 @@ by `rbs prototype` according to the heuristic rules.
41
41
  * This is useful to avoid `Ruby::IncompatibleAssignment` warning when right hand value uses `#freeze` method
42
42
  * ref: https://github.com/soutaro/steep/issues/363
43
43
  * Rule 3:
44
+ * Convert a callback method of ActiveModel subclass to a method returning "void" (ex. `before_save` callback)
45
+ * Rule 4:
44
46
  * Convert a scoped module/class definition (ex. `Foo::Bar::Baz`) to the nested definitions
45
47
  * This is useful to define intermediate modules automatically like what Rails and zeitwerk does.
46
48
 
@@ -7,7 +7,7 @@ module RbsHeuristicPrototype
7
7
  def create_raketask
8
8
  create_file "lib/tasks/rbs_heuristic_prototype.rake", <<~RUBY
9
9
  begin
10
- require 'rbs_heuristic_prototype/rake_task'
10
+ require 'rbs_heuristic_prototype'
11
11
  RbsHeuristicPrototype::RakeTask.new
12
12
  rescue LoadError
13
13
  # failed to load rbs_heuristic_prototype. Skip to load rbs_heuristic_prototype tasks.
@@ -29,7 +29,7 @@ module RbsHeuristicPrototype
29
29
  overloads = member.overloads.map do |overload|
30
30
  overload.update(method_type: process_method_type(overload.method_type))
31
31
  end
32
- member.update(overloads:)
32
+ member.update(overloads: overloads)
33
33
  else
34
34
  member
35
35
  end
@@ -40,15 +40,15 @@ module RbsHeuristicPrototype
40
40
 
41
41
  def process_method_type(method_type)
42
42
  type = process_type(method_type.type)
43
- method_type.update(type:)
43
+ method_type.update(type: type)
44
44
  end
45
45
 
46
46
  def process_type(type)
47
47
  # @type var location: untyped
48
48
  name = RBS::TypeName.new(namespace: RBS::Namespace.empty, name: :void)
49
49
  location = type.return_type.location
50
- return_type = RBS::Types::Alias.new(name:, args: [], location:)
51
- type.update(return_type:)
50
+ return_type = RBS::Types::Alias.new(name: name, args: [], location: location)
51
+ type.update(return_type: return_type)
52
52
  end
53
53
  end
54
54
  end
@@ -16,7 +16,7 @@ module RbsHeuristicPrototype
16
16
  process(decl)
17
17
  end
18
18
  RBS::Environment.new.tap do |env|
19
- env.add_signature(buffer: RBS::Buffer.new(name: "dummy", content: ""), directives: [], decls:)
19
+ env.add_signature(buffer: RBS::Buffer.new(name: "dummy", content: ""), directives: [], decls: decls)
20
20
  end
21
21
  end
22
22
 
@@ -46,7 +46,7 @@ module RbsHeuristicPrototype
46
46
  RBS::AST::Declarations::Module.new(
47
47
  name: decl.name,
48
48
  type_params: decl.type_params,
49
- members:,
49
+ members: members,
50
50
  self_types: decl.self_types,
51
51
  annotations: decl.annotations,
52
52
  location: decl.location,
@@ -68,7 +68,7 @@ module RbsHeuristicPrototype
68
68
  name: decl.name,
69
69
  type_params: decl.type_params,
70
70
  super_class: decl.super_class,
71
- members:,
71
+ members: members,
72
72
  annotations: decl.annotations,
73
73
  location: decl.location,
74
74
  comment: decl.comment
@@ -12,7 +12,7 @@ module RbsHeuristicPrototype
12
12
  overloads = member.overloads.map do |overload|
13
13
  overload.update(method_type: process_method_type(overload.method_type))
14
14
  end
15
- member.update(overloads:)
15
+ member.update(overloads: overloads)
16
16
  else
17
17
  member
18
18
  end
@@ -23,15 +23,15 @@ module RbsHeuristicPrototype
23
23
 
24
24
  def process_method_type(method_type)
25
25
  type = process_type(method_type.type)
26
- method_type.update(type:)
26
+ method_type.update(type: type)
27
27
  end
28
28
 
29
29
  def process_type(type)
30
30
  # @type var location: untyped
31
31
  name = RBS::TypeName.new(namespace: RBS::Namespace.empty, name: :boolish)
32
32
  location = type.return_type.location
33
- return_type = RBS::Types::Alias.new(name:, args: [], location:)
34
- type.update(return_type:)
33
+ return_type = RBS::Types::Alias.new(name: name, args: [], location: location)
34
+ type.update(return_type: return_type)
35
35
  end
36
36
  end
37
37
  end
@@ -67,7 +67,7 @@ module RbsHeuristicPrototype
67
67
  RBS::AST::Declarations::Class.new(
68
68
  name: TypeName(obj.name.to_s.split("::").last.to_s),
69
69
  type_params: [],
70
- super_class:,
70
+ super_class: super_class,
71
71
  members: [],
72
72
  annotations: [],
73
73
  location: nil,
@@ -20,7 +20,7 @@ module RbsHeuristicPrototype
20
20
 
21
21
  def process_constant_type(type)
22
22
  name = RBS::TypeName.new(namespace: RBS::Namespace.root, name: :Symbol)
23
- symbol = RBS::Types::Alias.new(name:, args: [], location: type.location)
23
+ symbol = RBS::Types::Alias.new(name: name, args: [], location: type.location)
24
24
  RBS::Types::ClassInstance.new(name: type.name, args: [symbol], location: type.location)
25
25
  end
26
26
 
@@ -51,13 +51,13 @@ module RbsHeuristicPrototype
51
51
 
52
52
  def load_env(path)
53
53
  loader = RBS::EnvironmentLoader.new(core_root: nil)
54
- loader.add(path:)
54
+ loader.add(path: path)
55
55
  RBS::Environment.from_loader(loader)
56
56
  end
57
57
 
58
58
  def write_env(path, env)
59
59
  path.open("wt") do |out|
60
- RBS::Writer.new(out:).write(env.declarations)
60
+ RBS::Writer.new(out: out).write(env.declarations)
61
61
  end
62
62
  end
63
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsHeuristicPrototype
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -2,7 +2,7 @@
2
2
  sources:
3
3
  - type: git
4
4
  name: ruby/gem_rbs_collection
5
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
5
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
6
6
  remote: https://github.com/ruby/gem_rbs_collection.git
7
7
  repo_dir: gems
8
8
  path: ".gem_rbs_collection"
@@ -16,7 +16,7 @@ gems:
16
16
  source:
17
17
  type: git
18
18
  name: ruby/gem_rbs_collection
19
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
19
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
20
20
  remote: https://github.com/ruby/gem_rbs_collection.git
21
21
  repo_dir: gems
22
22
  - name: actionview
@@ -24,7 +24,7 @@ gems:
24
24
  source:
25
25
  type: git
26
26
  name: ruby/gem_rbs_collection
27
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
27
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
28
28
  remote: https://github.com/ruby/gem_rbs_collection.git
29
29
  repo_dir: gems
30
30
  - name: activemodel
@@ -32,7 +32,7 @@ gems:
32
32
  source:
33
33
  type: git
34
34
  name: ruby/gem_rbs_collection
35
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
35
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
36
36
  remote: https://github.com/ruby/gem_rbs_collection.git
37
37
  repo_dir: gems
38
38
  - name: activerecord
@@ -40,7 +40,7 @@ gems:
40
40
  source:
41
41
  type: git
42
42
  name: ruby/gem_rbs_collection
43
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
43
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
44
44
  remote: https://github.com/ruby/gem_rbs_collection.git
45
45
  repo_dir: gems
46
46
  - name: activesupport
@@ -48,7 +48,7 @@ gems:
48
48
  source:
49
49
  type: git
50
50
  name: ruby/gem_rbs_collection
51
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
51
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
52
52
  remote: https://github.com/ruby/gem_rbs_collection.git
53
53
  repo_dir: gems
54
54
  - name: ast
@@ -56,7 +56,7 @@ gems:
56
56
  source:
57
57
  type: git
58
58
  name: ruby/gem_rbs_collection
59
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
59
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
60
60
  remote: https://github.com/ruby/gem_rbs_collection.git
61
61
  repo_dir: gems
62
62
  - name: cgi
@@ -68,7 +68,7 @@ gems:
68
68
  source:
69
69
  type: git
70
70
  name: ruby/gem_rbs_collection
71
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
71
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
72
72
  remote: https://github.com/ruby/gem_rbs_collection.git
73
73
  repo_dir: gems
74
74
  - name: date
@@ -80,7 +80,7 @@ gems:
80
80
  source:
81
81
  type: git
82
82
  name: ruby/gem_rbs_collection
83
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
83
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
84
84
  remote: https://github.com/ruby/gem_rbs_collection.git
85
85
  repo_dir: gems
86
86
  - name: json
@@ -108,7 +108,7 @@ gems:
108
108
  source:
109
109
  type: git
110
110
  name: ruby/gem_rbs_collection
111
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
111
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
112
112
  remote: https://github.com/ruby/gem_rbs_collection.git
113
113
  repo_dir: gems
114
114
  - name: optparse
@@ -120,7 +120,7 @@ gems:
120
120
  source:
121
121
  type: git
122
122
  name: ruby/gem_rbs_collection
123
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
123
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
124
124
  remote: https://github.com/ruby/gem_rbs_collection.git
125
125
  repo_dir: gems
126
126
  - name: pathname
@@ -132,7 +132,7 @@ gems:
132
132
  source:
133
133
  type: git
134
134
  name: ruby/gem_rbs_collection
135
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
135
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
136
136
  remote: https://github.com/ruby/gem_rbs_collection.git
137
137
  repo_dir: gems
138
138
  - name: rails-dom-testing
@@ -140,7 +140,7 @@ gems:
140
140
  source:
141
141
  type: git
142
142
  name: ruby/gem_rbs_collection
143
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
143
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
144
144
  remote: https://github.com/ruby/gem_rbs_collection.git
145
145
  repo_dir: gems
146
146
  - name: railties
@@ -148,7 +148,7 @@ gems:
148
148
  source:
149
149
  type: git
150
150
  name: ruby/gem_rbs_collection
151
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
151
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
152
152
  remote: https://github.com/ruby/gem_rbs_collection.git
153
153
  repo_dir: gems
154
154
  - name: rainbow
@@ -156,17 +156,21 @@ gems:
156
156
  source:
157
157
  type: git
158
158
  name: ruby/gem_rbs_collection
159
- revision: 80c41dad0190d5968841b8e892523e5031fa3eb1
159
+ revision: 9330d49993d18362cce9190b9596f03d1f4915f8
160
160
  remote: https://github.com/ruby/gem_rbs_collection.git
161
161
  repo_dir: gems
162
162
  - name: rbs
163
- version: 3.1.0
163
+ version: 3.1.2
164
164
  source:
165
165
  type: rubygems
166
166
  - name: rdoc
167
167
  version: '0'
168
168
  source:
169
169
  type: stdlib
170
+ - name: securerandom
171
+ version: '0'
172
+ source:
173
+ type: stdlib
170
174
  - name: singleton
171
175
  version: '0'
172
176
  source:
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Update prototype signature files by heuristic rules"
13
13
  spec.homepage = "https://github.com/tk0miya/rbs_heuristic_prototype"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.1.0"
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
@@ -0,0 +1,5 @@
1
+ module ActiveModel
2
+ module Validations
3
+ def self.__callbacks: () -> Hash[Symbol, Array[untyped]]
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class Thor
2
+ module Actions
3
+ def create_file: (String destination, *String? args, ?config: bool) ?{ () -> void } -> untyped
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs_heuristic_prototype
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi KOMIYA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -63,6 +63,8 @@ files:
63
63
  - sig/rbs_heuristic_prototype/filters/deep_module_filter.rbs
64
64
  - sig/rbs_heuristic_prototype/filters/symbol_array_constants_filter.rbs
65
65
  - sig/rbs_heuristic_prototype/rake_task.rbs
66
+ - sig/shims/active_model.rbs
67
+ - sig/shims/thor.rbs
66
68
  homepage: https://github.com/tk0miya/rbs_heuristic_prototype
67
69
  licenses:
68
70
  - MIT
@@ -78,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
80
  requirements:
79
81
  - - ">="
80
82
  - !ruby/object:Gem::Version
81
- version: 3.1.0
83
+ version: 2.7.0
82
84
  required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  requirements:
84
86
  - - ">="