sord 6.0.0 → 7.1.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/.github/workflows/examples.yml +22 -0
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +36 -0
- data/Gemfile +4 -0
- data/Rakefile +109 -56
- data/lib/sord/generator.rb +40 -9
- data/lib/sord/logging.rb +2 -1
- data/lib/sord/parlour_plugin.rb +1 -0
- data/lib/sord/resolver.rb +13 -6
- data/lib/sord/type_converter.rb +19 -8
- data/lib/sord/version.rb +1 -1
- data/rbi/sord.rbi +9 -4
- data/sord.gemspec +4 -3
- metadata +30 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f9681f7b1837fb0fb51588fb60d8bb94406b9bb9a488670244542971b0b66c7
|
4
|
+
data.tar.gz: 7db1dc6e7a1e3cf43d08ef6850da15eaebf18463fb5a329cdf42acb7da12c0a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84ae70452bf558690f4da7c7fb6c2b1ba65b4cf906a813b04c27766b7ad7ddb549013b49f149593c0a4366016689c0f21f904c09cd3533a19f42ea814655fea7
|
7
|
+
data.tar.gz: 349e397a495df5dd01d7a13eac6541f9d2b0446dbc150e74be756dbc02ead11e7c558ec27f111d852f6c39f4719deb6ba6c56bffed99a44af5a11570f20ea3fc
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Run Sord on examples
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
continue-on-error: false
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Set up Ruby
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 3.4 # Use latest for best chance of dependencies resolving
|
15
|
+
- name: Install dependencies
|
16
|
+
run: bundle install
|
17
|
+
- name: Install example dependencies
|
18
|
+
run: sudo apt-get install libldap2-dev libidn11-dev # Dependencies for `addressable`
|
19
|
+
- name: Run examples (RBI)
|
20
|
+
run: bundle exec rake examples:seed[rbi]
|
21
|
+
- name: Run examples (RBS)
|
22
|
+
run: bundle exec rake examples:reseed[rbs]
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,42 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
5
5
|
|
6
|
+
## [7.1.0] - 2025-07-07
|
7
|
+
### Added
|
8
|
+
- `nil` can be used as an alias for `NilClass` in more places in YARD types. (Thanks @apiology)
|
9
|
+
- The Solargraph convention `undefined` can now be used as an "untyped" type. (Thanks @apiology)
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- If a constant's value does not parse successfully, type information can still be generated for
|
13
|
+
that constant, and Sord emits a warning. Previously, this would cause a fatal exception.
|
14
|
+
- The version restriction on the RBS gem has been relaxed, to permit usage of 4.x versions.
|
15
|
+
RBS 3.x can still be used as before.
|
16
|
+
(Thanks @apiology)
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
- Sord now correctly resolves namespaces when classes have a namespace, e.g. `class X::Y`.
|
20
|
+
(Thanks @dorner)
|
21
|
+
|
22
|
+
## [7.0.0] - 2025-03-03
|
23
|
+
### Added
|
24
|
+
- Messages now show the file and line number that the message originated from. (Thanks @apiology)
|
25
|
+
- Sord will now recognise `Class<T, E>` as an equivalent of `Class<T>, Class<E>`, similar to the
|
26
|
+
existing behaviour for `Array`. (Thanks @tomoasleep)
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
- **Breaking change**: Now uses Commander 5.0 to support Ruby 3.3. This increases the minimum
|
30
|
+
required Ruby version to 3.0.
|
31
|
+
- **Breaking change**: Parlour version has been bumped significantly, from 5.0 to 9.1. This may be
|
32
|
+
relevant if you're using other Parlour plugins alongside Sord.
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
- Sord now generates correct RBI when heredoc strings are used in constants. (Thanks @apiology)
|
36
|
+
- Fixed error when using as a Parlour plugin, but without any custom tags defined. (Thanks
|
37
|
+
@dsisnero)
|
38
|
+
- Fixed incorrect precedence when union types were nested inside hashes. (Thanks @apiology)
|
39
|
+
- Sord now adds `::` when required, to disambiguate nested namespaces from top-level ones. (Thanks
|
40
|
+
@sinsoku)
|
41
|
+
|
6
42
|
## [6.0.0] - 2023-05-02
|
7
43
|
### Changed
|
8
44
|
- **Breaking change**: Now targets RBS 3.0
|
data/Gemfile
CHANGED
@@ -2,3 +2,7 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in sord.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
# Not in gemspec so it doesn't get distributed or depended on by the built gem.
|
7
|
+
# Used by resolver tests, to ensure Sord can import bundled RBIs from gems.
|
8
|
+
gem 'resolver-test', path: 'spec/resolver-test-gem'
|
data/Rakefile
CHANGED
@@ -19,85 +19,138 @@ REPOS = {
|
|
19
19
|
zeitwerk: 'https://github.com/fxn/zeitwerk'
|
20
20
|
}
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
# Thrown by tasks to present a "friendly" error message and abort the task.
|
23
|
+
class TaskError < StandardError
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
# Handles Sord examples, including checkout and running Sord to generate types.
|
27
|
+
class ExampleRunner
|
28
|
+
attr_reader :mode, :mode_arg, :clean
|
29
|
+
alias clean? clean
|
30
|
+
|
31
|
+
# @return [<Symbol>] Names of gems where Sord failed.
|
32
|
+
attr_accessor :failed_examples
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
# @param [String] mode "rbi" or "rbs".
|
35
|
+
# @param [Boolean] clean Run Sord with additional options to generate minimal type output.
|
36
|
+
def initialize(mode:, clean: false)
|
37
|
+
@mode = mode
|
38
|
+
@clean = clean
|
39
|
+
|
40
|
+
if mode == 'rbi'
|
41
|
+
@mode_arg = '--rbi'
|
42
|
+
elsif mode == 'rbs'
|
43
|
+
@mode_arg = '--rbs'
|
37
44
|
else
|
38
|
-
|
39
|
-
|
45
|
+
raise TaskError, 'please specify \'rbi\' or \'rbs\'!'
|
46
|
+
end
|
47
|
+
|
48
|
+
@failed_examples = []
|
49
|
+
end
|
50
|
+
|
51
|
+
# Create the `sord_examples` directory, ready for checkouts.
|
52
|
+
# @raise [TaskError] If it already exists.
|
53
|
+
def create_examples_dir
|
54
|
+
if File.directory?(File.join(__dir__, 'sord_examples'))
|
55
|
+
raise TaskError, 'sord_examples directory already exists, please delete the directory or run a reseed!'
|
40
56
|
end
|
41
57
|
|
42
58
|
FileUtils.mkdir 'sord_examples'
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
59
|
+
end
|
60
|
+
|
61
|
+
# Check that the `sord_examples` directory exists.
|
62
|
+
# @raise [TaskError] If it doesn't.
|
63
|
+
def validate_examples_dir
|
64
|
+
unless File.directory?(File.join(__dir__, 'sord_examples'))
|
65
|
+
raise TaskError, 'The sord_examples directory does not exist. Have you run the seed task?'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check out a repository, add Sord to its Gemfile, and install its dependencies.
|
70
|
+
# @param [Symbol] name Name of the checkout.
|
71
|
+
# @param [String] url Git URL.
|
72
|
+
def prepare_checkout(name, url)
|
73
|
+
Dir.chdir(File.join(__dir__, 'sord_examples')) do
|
74
|
+
puts "Cloning #{name}..."
|
75
|
+
system("git clone #{url} --depth=1")
|
76
|
+
|
77
|
+
Dir.chdir(name.to_s) do
|
51
78
|
# Add sord to gemfile.
|
52
79
|
`echo "gem 'sord', path: '../../'" >> Gemfile`
|
80
|
+
|
53
81
|
# Run bundle install.
|
54
82
|
system('bundle install')
|
55
|
-
# Generate sri
|
56
|
-
puts "Generating rbi for #{name}..."
|
57
|
-
if args[:clean]
|
58
|
-
system("bundle exec sord ../#{name}.#{args[:mode]} #{mode_arg} --no-sord-comments --replace-errors-with-untyped --replace-unresolved-with-untyped")
|
59
|
-
else
|
60
|
-
system("bundle exec sord ../#{name}.#{args[:mode]} #{mode_arg}")
|
61
|
-
end
|
62
|
-
puts "#{name}.#{args[:mode]} generated!"
|
63
|
-
FileUtils.cd '..'
|
64
83
|
end
|
65
84
|
end
|
85
|
+
end
|
66
86
|
|
67
|
-
|
87
|
+
# Run Sord on a checked-out repository.
|
88
|
+
# @param [Symbol] name Name of the checkout.
|
89
|
+
def generate_types(name)
|
90
|
+
puts "Generating rbi for #{name}..."
|
91
|
+
|
92
|
+
Dir.chdir(File.join(__dir__, 'sord_examples', name.to_s)) do
|
93
|
+
if clean?
|
94
|
+
system("bundle exec sord ../#{name}.#{mode} #{mode_arg} --no-sord-comments --replace-errors-with-untyped --replace-unresolved-with-untyped")
|
95
|
+
else
|
96
|
+
system("bundle exec sord ../#{name}.#{mode} #{mode_arg}")
|
97
|
+
end
|
98
|
+
|
99
|
+
if $?.success?
|
100
|
+
puts "#{name}.#{mode} generated!"
|
101
|
+
else
|
102
|
+
puts "Sord exited with error"
|
103
|
+
failed_examples << name
|
104
|
+
end
|
105
|
+
end
|
68
106
|
end
|
69
107
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
raise Rainbow("The sord_examples directory does not exist. Have you run the seed task?").red.bold
|
108
|
+
# Check that all Sord executions were successful.
|
109
|
+
# @raise [TaskError] If any failed.
|
110
|
+
def validate_sord_success
|
111
|
+
if failed_examples.any?
|
112
|
+
raise TaskError, "Not all Sord runs were successful: #{failed_examples.map(&:to_s).join(', ')}"
|
76
113
|
end
|
114
|
+
end
|
115
|
+
end
|
77
116
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
117
|
+
namespace :examples do
|
118
|
+
require 'fileutils'
|
119
|
+
require 'rainbow'
|
120
|
+
|
121
|
+
desc "Clone git repositories and run Sord on them as examples"
|
122
|
+
task :seed, [:mode, :clean] do |t, args|
|
123
|
+
examples = ExampleRunner.new(**args)
|
124
|
+
examples.create_examples_dir
|
125
|
+
|
126
|
+
Bundler.with_clean_env do
|
127
|
+
REPOS.each do |name, url|
|
128
|
+
examples.prepare_checkout(name, url)
|
129
|
+
examples.generate_types(name)
|
130
|
+
end
|
85
131
|
end
|
132
|
+
examples.validate_sord_success
|
133
|
+
|
134
|
+
puts Rainbow("Seeding complete!").green
|
135
|
+
|
136
|
+
rescue TaskError => e
|
137
|
+
abort Rainbow(e.to_s).red
|
138
|
+
end
|
139
|
+
|
140
|
+
desc 'Regenerate the rbi files in sord_examples.'
|
141
|
+
task :reseed, [:mode, :clean] do |t, args|
|
142
|
+
examples = ExampleRunner.new(**args)
|
143
|
+
examples.validate_examples_dir
|
86
144
|
|
87
145
|
REPOS.keys.each do |name|
|
88
|
-
|
89
|
-
puts "Regenerating rbi file for #{name}..."
|
90
|
-
Bundler.with_clean_env do
|
91
|
-
if args[:clean]
|
92
|
-
system("bundle exec sord ../#{name}.#{args[:mode]} #{mode_arg} --no-regenerate --no-sord-comments --replace-errors-with-untyped --replace-unresolved-with-untyped")
|
93
|
-
else
|
94
|
-
system("bundle exec sord ../#{name}.#{args[:mode]} #{mode_arg} --no-regenerate")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
FileUtils.cd '..'
|
146
|
+
examples.generate_types(name)
|
98
147
|
end
|
148
|
+
examples.validate_sord_success
|
99
149
|
|
100
150
|
puts Rainbow("Re-seeding complete!").green
|
151
|
+
|
152
|
+
rescue TaskError => e
|
153
|
+
abort Rainbow(e.to_s).red
|
101
154
|
end
|
102
155
|
|
103
156
|
desc 'Delete the sord_examples directory to allow the seeder to run again.'
|
data/lib/sord/generator.rb
CHANGED
@@ -4,6 +4,7 @@ require 'sord/type_converter'
|
|
4
4
|
require 'sord/logging'
|
5
5
|
require 'parlour'
|
6
6
|
require 'rainbow'
|
7
|
+
require 'parser/current'
|
7
8
|
|
8
9
|
module Sord
|
9
10
|
# Converts the current working directory's YARD registry into an type
|
@@ -80,7 +81,6 @@ module Sord
|
|
80
81
|
|
81
82
|
# Hook the logger so that warnings are collected
|
82
83
|
Logging.add_hook do |type, msg, item|
|
83
|
-
# TODO: is it possible to get line numbers here?
|
84
84
|
warnings << [msg, item, 0] if type == :warn
|
85
85
|
end
|
86
86
|
end
|
@@ -141,7 +141,32 @@ module Sord
|
|
141
141
|
# Add the constant to the current object being generated.
|
142
142
|
case @mode
|
143
143
|
when :rbi
|
144
|
-
|
144
|
+
# Parse so we can set up constant with correct heredoc syntax
|
145
|
+
kwargs = {}
|
146
|
+
|
147
|
+
value = constant.value
|
148
|
+
begin
|
149
|
+
value_node = Parser::CurrentRuby.parse(constant.value)
|
150
|
+
loc = value_node.loc
|
151
|
+
if loc.instance_of? Parser::Source::Map::Heredoc
|
152
|
+
#
|
153
|
+
# heredocs in Ruby come after the full expression is complete. e.g.,
|
154
|
+
# puts(>>FOO)
|
155
|
+
# bar
|
156
|
+
# FOO
|
157
|
+
#
|
158
|
+
# so if we want to wrap them in a T.let, we need to parse out the expression vs the rest
|
159
|
+
kwargs[:heredocs] = constant.value[loc.heredoc_body.begin_pos...loc.heredoc_end.end_pos]
|
160
|
+
expression = loc.expression
|
161
|
+
value = constant.value[expression.begin_pos...expression.end_pos]
|
162
|
+
end
|
163
|
+
|
164
|
+
rescue Parser::SyntaxError => e
|
165
|
+
# Emit a warning, since this may cause a syntax error when parsing the RBI
|
166
|
+
Logging.warn("syntax error on constant value: #{e}", constant)
|
167
|
+
end
|
168
|
+
|
169
|
+
@current_object.create_constant(constant_name, value: "T.let(#{value}, T.untyped)", **kwargs) do |c|
|
145
170
|
c.add_comments(constant.docstring.all.split("\n"))
|
146
171
|
end
|
147
172
|
when :rbs
|
@@ -582,8 +607,10 @@ module Sord
|
|
582
607
|
return if @hide_private && item.visibility == :private
|
583
608
|
count_namespace
|
584
609
|
|
585
|
-
superclass
|
586
|
-
|
610
|
+
if item.type == :class && item.superclass.to_s != "Object"
|
611
|
+
prefix = "::" if item.name.to_s == item.superclass.path
|
612
|
+
superclass = "#{prefix}#{item.superclass.path}"
|
613
|
+
end
|
587
614
|
|
588
615
|
parent = @current_object
|
589
616
|
@current_object = item.type == :class \
|
@@ -651,14 +678,18 @@ module Sord
|
|
651
678
|
Logging.warn("Please edit the file to fix these errors.")
|
652
679
|
Logging.warn("Alternatively, edit your YARD documentation so that your types are valid and re-run Sord.")
|
653
680
|
warnings.each do |(msg, item, _)|
|
654
|
-
|
681
|
+
message = if item
|
682
|
+
(filename, line), = item.files
|
683
|
+
" #{Rainbow("(#{item.path}) #{filename}:#{line}:").bold} #{msg}"
|
684
|
+
else
|
685
|
+
" #{msg}"
|
686
|
+
end
|
687
|
+
puts message
|
655
688
|
end
|
656
689
|
end
|
657
690
|
rescue
|
658
|
-
Logging.error($!)
|
659
|
-
|
660
|
-
puts " #{line}"
|
661
|
-
end
|
691
|
+
Logging.error("An internal error occurred while running Sord: #{$!}")
|
692
|
+
raise
|
662
693
|
end
|
663
694
|
|
664
695
|
# Given two pairs of arrays representing method parameters, in the form
|
data/lib/sord/logging.rb
CHANGED
@@ -74,7 +74,8 @@ module Sord
|
|
74
74
|
return unless enabled_types.include?(kind)
|
75
75
|
|
76
76
|
message = if item
|
77
|
-
|
77
|
+
(filename, line), = item.files
|
78
|
+
"#{header} #{Rainbow("(#{item.path}) #{filename}:#{line}:").bold} #{msg}"
|
78
79
|
else
|
79
80
|
"#{header} #{msg}"
|
80
81
|
end
|
data/lib/sord/parlour_plugin.rb
CHANGED
data/lib/sord/resolver.rb
CHANGED
@@ -70,14 +70,21 @@ module Sord
|
|
70
70
|
klasses = [
|
71
71
|
Parlour::RbiGenerator::Constant,
|
72
72
|
Parlour::RbiGenerator::ModuleNamespace,
|
73
|
-
Parlour::RbiGenerator::ClassNamespace
|
73
|
+
Parlour::RbiGenerator::ClassNamespace,
|
74
|
+
Parlour::RbiGenerator::Namespace
|
75
|
+
]
|
76
|
+
child_only_classes = [
|
77
|
+
Parlour::RbiGenerator::Namespace
|
74
78
|
]
|
75
79
|
nodes.each do |node|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
if klasses.include?(node.class)
|
81
|
+
new_path = path + [node.name]
|
82
|
+
unless child_only_classes.include?(node.class)
|
83
|
+
names_to_paths[node.name] ||= Set.new
|
84
|
+
names_to_paths[node.name] << new_path.join('::')
|
85
|
+
end
|
86
|
+
add_rbi_objects_to_paths(node.children, names_to_paths, new_path) if node.respond_to?(:children)
|
87
|
+
end
|
81
88
|
end
|
82
89
|
end
|
83
90
|
|
data/lib/sord/type_converter.rb
CHANGED
@@ -24,7 +24,7 @@ module Sord
|
|
24
24
|
# Matches valid method names.
|
25
25
|
# From: https://stackoverflow.com/a/4379197/2626000
|
26
26
|
METHOD_NAME_REGEX =
|
27
|
-
/(?:[a-z_]\w*[?!=]?|\[\]=?|<<|>>|\*\*|[!~+\*\/%&^|-]|[<>]=?|<=>|={2,3}|![=~]|=~)/i
|
27
|
+
/(?:[a-z_]\w*[?!=]?|\[\]=?|<<|>>|\*\*|[!~+\*\/%&^|-]|[<>]=?|<=>|={2,3}|![=~]|=~)/i
|
28
28
|
|
29
29
|
# Match duck types which require the object implement one or more methods,
|
30
30
|
# like '#foo', '#foo & #bar', '#foo&#bar&#baz', and '#foo&#bar&#baz&#foo_bar'.
|
@@ -76,13 +76,15 @@ module Sord
|
|
76
76
|
end
|
77
77
|
|
78
78
|
# Handle hash rockets as separators.
|
79
|
-
# e.g. Hash<Symbol => String>
|
79
|
+
# e.g. Hash<Symbol => String> or Hash<Symbol, String => Integer>
|
80
80
|
if params[character_pointer] == '=' && params[character_pointer + 1] == '>'
|
81
81
|
if current_bracketing_level == 0
|
82
82
|
character_pointer += 1
|
83
83
|
result << buffer.strip
|
84
84
|
buffer = ""
|
85
|
-
|
85
|
+
# commas are higher precedence
|
86
|
+
result = [result] if result.length > 1
|
87
|
+
return [result.first, split_type_parameters(params[character_pointer+1..-1].strip)]
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
@@ -127,8 +129,12 @@ module Sord
|
|
127
129
|
case yard
|
128
130
|
when nil # Type not specified
|
129
131
|
Parlour::Types::Untyped.new
|
132
|
+
when "nil"
|
133
|
+
Parlour::Types::Raw.new('NilClass')
|
130
134
|
when "bool", "Bool", "boolean", "Boolean", "true", "false"
|
131
135
|
Parlour::Types::Boolean.new
|
136
|
+
when "undefined" # solargraph convention
|
137
|
+
Parlour::Types::Untyped.new
|
132
138
|
when 'self'
|
133
139
|
Parlour::Types::Self.new
|
134
140
|
when Array
|
@@ -193,12 +199,17 @@ module Sord
|
|
193
199
|
relative_generic_type = generic_type.start_with?('::') \
|
194
200
|
? generic_type[2..-1] : generic_type
|
195
201
|
|
196
|
-
|
202
|
+
yard_parameters = split_type_parameters(type_parameters)
|
203
|
+
parameters = yard_parameters
|
197
204
|
.map { |x| yard_to_parlour(x, item, config) }
|
198
|
-
if SINGLE_ARG_GENERIC_TYPES.include?(relative_generic_type) &&
|
199
|
-
Parlour::Types.const_get(relative_generic_type).new(
|
200
|
-
elsif relative_generic_type == 'Class'
|
201
|
-
|
205
|
+
if SINGLE_ARG_GENERIC_TYPES.include?(relative_generic_type) && yard_parameters.length > 1
|
206
|
+
Parlour::Types.const_get(relative_generic_type).new(yard_to_parlour(yard_parameters, item, config))
|
207
|
+
elsif relative_generic_type == 'Class'
|
208
|
+
if parameters.length == 1
|
209
|
+
Parlour::Types::Class.new(parameters.first)
|
210
|
+
else
|
211
|
+
Parlour::Types::Union.new(parameters.map { |x| Parlour::Types::Class.new(x) })
|
212
|
+
end
|
202
213
|
elsif relative_generic_type == 'Hash'
|
203
214
|
if parameters.length == 2
|
204
215
|
Parlour::Types::Hash.new(*parameters)
|
data/lib/sord/version.rb
CHANGED
data/rbi/sord.rbi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# typed: strong
|
2
2
|
# typed: strong
|
3
3
|
module Sord
|
4
|
-
VERSION = T.let('
|
4
|
+
VERSION = T.let('7.1.0', T.untyped)
|
5
5
|
|
6
6
|
# Handles writing logs to stdout and any other classes which request them.
|
7
7
|
module Logging
|
@@ -178,12 +178,12 @@ module Sord
|
|
178
178
|
sig { params(hash: T.untyped).returns(T.untyped) }
|
179
179
|
def self.load_gem_objects(hash); end
|
180
180
|
|
181
|
-
# sord omit - no YARD type given for "
|
181
|
+
# sord omit - no YARD type given for "env", using untyped
|
182
182
|
# sord omit - no YARD type given for "names_to_paths", using untyped
|
183
183
|
# sord omit - no YARD type given for "path", using untyped
|
184
184
|
# sord omit - no YARD return type given, using untyped
|
185
|
-
sig { params(
|
186
|
-
def self.add_rbs_objects_to_paths(
|
185
|
+
sig { params(env: T.untyped, names_to_paths: T.untyped, path: T.untyped).returns(T.untyped) }
|
186
|
+
def self.add_rbs_objects_to_paths(env, names_to_paths, path = []); end
|
187
187
|
|
188
188
|
# sord omit - no YARD type given for "nodes", using untyped
|
189
189
|
# sord omit - no YARD type given for "names_to_paths", using untyped
|
@@ -253,6 +253,7 @@ module Sord
|
|
253
253
|
def add_constants(item); end
|
254
254
|
|
255
255
|
# sord warn - YARD::CodeObjects::NamespaceObject wasn't able to be resolved to a constant in this project
|
256
|
+
# sord warn - Parlour::TypedObject wasn't able to be resolved to a constant in this project
|
256
257
|
# Adds comments to an object based on a docstring.
|
257
258
|
#
|
258
259
|
# _@param_ `item`
|
@@ -415,6 +416,7 @@ module Sord
|
|
415
416
|
def self.split_type_parameters(params); end
|
416
417
|
|
417
418
|
# sord warn - YARD::CodeObjects::Base wasn't able to be resolved to a constant in this project
|
419
|
+
# sord warn - Parlour::Types::Type wasn't able to be resolved to a constant in this project
|
418
420
|
# Converts a YARD type into a Parlour type.
|
419
421
|
#
|
420
422
|
# _@param_ `yard` — The YARD type.
|
@@ -425,7 +427,9 @@ module Sord
|
|
425
427
|
sig { params(yard: T.any(T::Boolean, T::Array[T.untyped], String), item: YARD::CodeObjects::Base, config: Configuration).returns(Parlour::Types::Type) }
|
426
428
|
def self.yard_to_parlour(yard, item, config); end
|
427
429
|
|
430
|
+
# sord warn - Parlour::Types::Type wasn't able to be resolved to a constant in this project
|
428
431
|
# sord warn - YARD::CodeObjects::Base wasn't able to be resolved to a constant in this project
|
432
|
+
# sord warn - Parlour::Types::Type wasn't able to be resolved to a constant in this project
|
429
433
|
# Handles SORD_ERRORs.
|
430
434
|
#
|
431
435
|
# _@param_ `name`
|
@@ -445,6 +449,7 @@ module Sord
|
|
445
449
|
end
|
446
450
|
def self.handle_sord_error(name, log_warning, item, replace_errors_with_untyped); end
|
447
451
|
|
452
|
+
# sord warn - Parlour::Types::Type wasn't able to be resolved to a constant in this project
|
448
453
|
# Given a YARD duck type string, attempts to convert it to one of a list of pre-defined RBS
|
449
454
|
# built-in interfaces.
|
450
455
|
#
|
data/sord.gemspec
CHANGED
@@ -24,9 +24,10 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency 'yard'
|
26
26
|
spec.add_dependency 'sorbet-runtime'
|
27
|
-
spec.add_dependency 'commander', '~>
|
28
|
-
spec.add_dependency
|
29
|
-
spec.add_dependency '
|
27
|
+
spec.add_dependency 'commander', '~> 5.0'
|
28
|
+
spec.add_dependency "parser"
|
29
|
+
spec.add_dependency 'parlour', '~> 9.1'
|
30
|
+
spec.add_dependency 'rbs', '>=3.0', '<5'
|
30
31
|
|
31
32
|
spec.add_development_dependency "bundler", "~> 2.0"
|
32
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -44,42 +44,62 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: parser
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: parlour
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '9.1'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '9.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rbs
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '3.0'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '5'
|
76
93
|
type: :runtime
|
77
94
|
prerelease: false
|
78
95
|
version_requirements: !ruby/object:Gem::Requirement
|
79
96
|
requirements:
|
80
|
-
- - "
|
97
|
+
- - ">="
|
81
98
|
- !ruby/object:Gem::Version
|
82
99
|
version: '3.0'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '5'
|
83
103
|
- !ruby/object:Gem::Dependency
|
84
104
|
name: bundler
|
85
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +180,7 @@ extra_rdoc_files: []
|
|
160
180
|
files:
|
161
181
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
162
182
|
- ".github/ISSUE_TEMPLATE/feature-request.md"
|
183
|
+
- ".github/workflows/examples.yml"
|
163
184
|
- ".github/workflows/ruby.yml"
|
164
185
|
- ".gitignore"
|
165
186
|
- ".parlour"
|
@@ -200,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
221
|
- !ruby/object:Gem::Version
|
201
222
|
version: '0'
|
202
223
|
requirements: []
|
203
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.4.1
|
204
225
|
signing_key:
|
205
226
|
specification_version: 4
|
206
227
|
summary: Generate Sorbet RBI files from YARD documentation
|