yard-sorbet 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yard-sorbet.rb +2 -0
- data/lib/yard-sorbet/directives.rb +5 -1
- data/lib/yard-sorbet/sig_handler.rb +49 -12
- data/lib/yard-sorbet/sig_to_yard.rb +7 -2
- data/lib/yard-sorbet/struct_handler.rb +13 -5
- data/lib/yard-sorbet/version.rb +1 -1
- metadata +28 -25
- data/.editorconfig +0 -9
- data/.gitignore +0 -40
- data/.rspec +0 -3
- data/.rubocop.yml +0 -62
- data/.travis.yml +0 -8
- data/.yardopts +0 -2
- data/CHANGELOG.md +0 -30
- data/Gemfile +0 -8
- data/README.md +0 -17
- data/Rakefile +0 -19
- data/yard-sorbet.gemspec +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e83416e1d85da291aa4d0311df2e239f14fd072f38f3f2be4ee12a008f1a89dc
|
4
|
+
data.tar.gz: 3fcffa38addbaa3b47b200711462847b81bd9c52095aa1dfa46d2c077f497ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13f13c26aff10422e1fda98016fdfd1038d14a36d084653407b7797908206cde655f1504087b7ec164d6b72de2b9ded4d5f807c9c9af36d4a77e6c296828cd3d
|
7
|
+
data.tar.gz: 9bb8d82770501e206ac7f1bf6f6d836c0559383b9babd0e6416180e5508bed5bd7f55e317a5c86f30231ca7cdc08b30211b722645a558d4130c4f046a39471ec
|
data/lib/yard-sorbet.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Extract & re-add directives to a docstring
|
5
5
|
module YARDSorbet::Directives
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
sig { params(docstring: T.nilable(String)).returns([YARD::Docstring, T::Array[String]]) }
|
6
9
|
def self.extract_directives(docstring)
|
7
10
|
parser = YARD::DocstringParser.new.parse(docstring)
|
8
11
|
# Directives are already parsed at this point, and there doesn't
|
@@ -16,6 +19,7 @@ module YARDSorbet::Directives
|
|
16
19
|
[parser.to_docstring, directives]
|
17
20
|
end
|
18
21
|
|
22
|
+
sig { params(docstring: String, directives: T::Array[String]).void }
|
19
23
|
def self.add_directives(docstring, directives)
|
20
24
|
directives.each do |directive|
|
21
25
|
docstring.concat("\n#{directive}")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# A YARD Handler for Sorbet type declarations
|
@@ -6,7 +6,13 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
6
6
|
extend T::Sig
|
7
7
|
handles :class, :module, :singleton_class?
|
8
8
|
|
9
|
-
|
9
|
+
PARAM_EXCLUDES = T.let(%i[array call hash].freeze, T::Array[Symbol])
|
10
|
+
PROCESSABLE_NODES = T.let(%i[def defs command].freeze, T::Array[Symbol])
|
11
|
+
SIG_EXCLUDES = T.let(%i[array hash].freeze, T::Array[Symbol])
|
12
|
+
SIG_NODE_TYPES = T.let(%i[call fcall vcall].freeze, T::Array[Symbol])
|
13
|
+
private_constant :PARAM_EXCLUDES, :PROCESSABLE_NODES, :SIG_EXCLUDES, :SIG_NODE_TYPES
|
14
|
+
|
15
|
+
sig { void }
|
10
16
|
def process
|
11
17
|
# Find the list of declarations inside the class
|
12
18
|
class_def = statement.children.find { |c| c.type == :list }
|
@@ -15,6 +21,7 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
15
21
|
process_class_contents(class_contents)
|
16
22
|
end
|
17
23
|
|
24
|
+
sig { params(class_contents: T::Array[YARD::Parser::Ruby::MethodCallNode]).void }
|
18
25
|
private def process_class_contents(class_contents)
|
19
26
|
class_contents.each_with_index do |child, i|
|
20
27
|
if child.type == :sclass && child.children.size == 2 && child.children[1].type == :list
|
@@ -26,14 +33,21 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
26
33
|
next_statement = class_contents[i + 1]
|
27
34
|
next unless processable_method?(next_statement)
|
28
35
|
|
29
|
-
process_method_definition(next_statement, child)
|
36
|
+
process_method_definition(T.must(next_statement), child)
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
40
|
+
sig { params(next_statement: T.nilable(YARD::Parser::Ruby::AstNode)).returns(T::Boolean) }
|
33
41
|
private def processable_method?(next_statement)
|
34
|
-
|
42
|
+
PROCESSABLE_NODES.include?(next_statement&.type)
|
35
43
|
end
|
36
44
|
|
45
|
+
sig do
|
46
|
+
params(
|
47
|
+
method_node: YARD::Parser::Ruby::AstNode,
|
48
|
+
sig_node: YARD::Parser::Ruby::MethodCallNode
|
49
|
+
).void
|
50
|
+
end
|
37
51
|
private def process_method_definition(method_node, sig_node)
|
38
52
|
# Swap the method definition docstring and the sig docstring.
|
39
53
|
# Parse relevant parts of the `sig` and include them as well.
|
@@ -51,6 +65,7 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
51
65
|
sig_node.docstring = nil
|
52
66
|
end
|
53
67
|
|
68
|
+
sig { params(docstring: YARD::Docstring, name: String, types: T::Array[String]).void }
|
54
69
|
private def enhance_param(docstring, name, types)
|
55
70
|
tag = docstring.tags.find { |t| t.tag_name == 'param' && t.name == name }
|
56
71
|
if tag
|
@@ -62,6 +77,7 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
62
77
|
docstring.add_tag(tag)
|
63
78
|
end
|
64
79
|
|
80
|
+
sig { params(docstring: YARD::Docstring, type: Symbol, parsed_sig: T::Hash[Symbol, Object]).void }
|
65
81
|
private def enhance_tag(docstring, type, parsed_sig)
|
66
82
|
return if !parsed_sig[type]
|
67
83
|
|
@@ -77,19 +93,31 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
77
93
|
docstring.add_tag(tag)
|
78
94
|
end
|
79
95
|
|
96
|
+
sig do
|
97
|
+
params(sig_node: YARD::Parser::Ruby::MethodCallNode)
|
98
|
+
.returns(
|
99
|
+
{
|
100
|
+
abstract: T::Boolean,
|
101
|
+
params: T::Hash[String, T::Array[String]],
|
102
|
+
return: T.nilable(T::Array[String])
|
103
|
+
}
|
104
|
+
)
|
105
|
+
end
|
80
106
|
private def parse_sig(sig_node)
|
81
|
-
parsed = {
|
82
|
-
|
83
|
-
|
107
|
+
parsed = {
|
108
|
+
abstract: false,
|
109
|
+
params: {},
|
110
|
+
return: nil
|
111
|
+
}
|
84
112
|
found_params = T.let(false, T::Boolean)
|
85
113
|
found_return = T.let(false, T::Boolean)
|
86
|
-
bfs_traverse(sig_node, exclude:
|
114
|
+
bfs_traverse(sig_node, exclude: SIG_EXCLUDES) do |n|
|
87
115
|
if n.source == 'abstract'
|
88
116
|
parsed[:abstract] = true
|
89
117
|
elsif n.source == 'params' && !found_params
|
90
118
|
found_params = true
|
91
119
|
sibling = T.must(sibling_node(n))
|
92
|
-
bfs_traverse(sibling, exclude:
|
120
|
+
bfs_traverse(sibling, exclude: PARAM_EXCLUDES) do |p|
|
93
121
|
if p.type == :assoc
|
94
122
|
param_name = p.children.first.source[0...-1]
|
95
123
|
types = YARDSorbet::SigToYARD.convert(p.children.last)
|
@@ -107,16 +135,18 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
107
135
|
end
|
108
136
|
|
109
137
|
# Returns true if the given node is part of a type signature.
|
138
|
+
sig { params(node: T.nilable(YARD::Parser::Ruby::AstNode)).returns(T::Boolean) }
|
110
139
|
private def type_signature?(node)
|
111
140
|
loop do
|
112
141
|
return false if node.nil?
|
113
|
-
return false unless
|
142
|
+
return false unless SIG_NODE_TYPES.include?(node.type)
|
114
143
|
return true if T.unsafe(node).method_name(true) == :sig
|
115
144
|
|
116
|
-
node = node.children.first
|
145
|
+
node = T.let(node.children.first, T.nilable(YARD::Parser::Ruby::AstNode))
|
117
146
|
end
|
118
147
|
end
|
119
148
|
|
149
|
+
sig { params(node: YARD::Parser::Ruby::AstNode).returns(T.nilable(YARD::Parser::Ruby::AstNode)) }
|
120
150
|
private def sibling_node(node)
|
121
151
|
found_sibling = T.let(false, T::Boolean)
|
122
152
|
node.parent.children.each do |n|
|
@@ -132,7 +162,14 @@ class YARDSorbet::SigHandler < YARD::Handlers::Ruby::Base
|
|
132
162
|
end
|
133
163
|
|
134
164
|
# @yield [YARD::Parser::Ruby::AstNode]
|
135
|
-
|
165
|
+
sig do
|
166
|
+
params(
|
167
|
+
node: YARD::Parser::Ruby::AstNode,
|
168
|
+
exclude: T::Array[Symbol],
|
169
|
+
_blk: T.proc.params(n: YARD::Parser::Ruby::AstNode).void
|
170
|
+
).void
|
171
|
+
end
|
172
|
+
private def bfs_traverse(node, exclude: [], &_blk)
|
136
173
|
queue = [node]
|
137
174
|
while !queue.empty?
|
138
175
|
n = T.must(queue.shift)
|
@@ -1,17 +1,21 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Translate sig type syntax to YARD type syntax.
|
5
5
|
module YARDSorbet::SigToYARD
|
6
|
-
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
IS_LEGACY_RUBY_VERSION = T.let(RUBY_VERSION.start_with?('2.5.'), T::Boolean)
|
7
9
|
|
8
10
|
# @see https://yardoc.org/types.html
|
11
|
+
sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) }
|
9
12
|
def self.convert(node)
|
10
13
|
types = convert_type(node)
|
11
14
|
# scrub newlines, as they break the YARD parser
|
12
15
|
types.map { |type| type.gsub(/\n\s*/, ' ') }
|
13
16
|
end
|
14
17
|
|
18
|
+
sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) }
|
15
19
|
def self.convert_type(node)
|
16
20
|
children = node.children
|
17
21
|
case node.type
|
@@ -93,6 +97,7 @@ module YARDSorbet::SigToYARD
|
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
100
|
+
sig { params(node: YARD::Parser::Ruby::AstNode).returns(String) }
|
96
101
|
def self.build_generic_type(node)
|
97
102
|
return node.source if node.children.empty? || node.type != :aref
|
98
103
|
|
@@ -1,12 +1,15 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# Handle all `const` calls, creating accessor methods, and compiles them for later usage at the class level
|
5
5
|
# in creating a constructor
|
6
6
|
class YARDSorbet::StructHandler < YARD::Handlers::Ruby::Base
|
7
|
+
extend T::Sig
|
8
|
+
|
7
9
|
handles method_call(:const)
|
8
10
|
namespace_only
|
9
11
|
|
12
|
+
sig { void }
|
10
13
|
def process
|
11
14
|
# Store the property for use in the constructor definition
|
12
15
|
name = statement.parameters[0].jump(:ident).source
|
@@ -44,14 +47,19 @@ end
|
|
44
47
|
# Class-level handler that folds all `const` declarations into the constructor documentation
|
45
48
|
# this needs to be injected as a module otherwise the default Class handler will overwrite documentation
|
46
49
|
module YARDSorbet::StructClassHandler
|
50
|
+
extend T::Sig
|
51
|
+
|
52
|
+
sig { void }
|
47
53
|
def process
|
48
54
|
ret = super
|
49
55
|
|
50
|
-
return ret if extra_state.prop_docs.nil?
|
56
|
+
return ret if T.unsafe(self).extra_state.prop_docs.nil?
|
51
57
|
|
52
58
|
# lookup the full YARD path for the current class
|
53
|
-
class_ns = YARD::CodeObjects::ClassObject.new(
|
54
|
-
|
59
|
+
class_ns = YARD::CodeObjects::ClassObject.new(
|
60
|
+
T.unsafe(self).namespace, T.unsafe(self).statement[0].source.gsub(/\s/, '')
|
61
|
+
)
|
62
|
+
props = T.unsafe(self).extra_state.prop_docs[class_ns]
|
55
63
|
|
56
64
|
return ret if props.empty?
|
57
65
|
|
@@ -80,7 +88,7 @@ module YARDSorbet::StructClassHandler
|
|
80
88
|
object.source ||= props.map { |p| p[:source] }.join("\n")
|
81
89
|
object.explicit ||= false # not strictly necessary
|
82
90
|
|
83
|
-
register(object)
|
91
|
+
T.unsafe(self).register(object)
|
84
92
|
|
85
93
|
object.docstring = docstring.to_raw
|
86
94
|
|
data/lib/yard-sorbet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-sorbet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Eichelberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.8.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-performance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.9.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.9.2
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
103
|
+
version: 2.1.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
110
|
+
version: 2.1.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop-sorbet
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,56 +128,56 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
131
|
+
version: '0.21'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
138
|
+
version: '0.21'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: sorbet
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.5.
|
145
|
+
version: 0.5.6193
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.5.
|
152
|
+
version: 0.5.6193
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: sorbet-runtime
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - ">="
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
159
|
+
version: 0.5.5845
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
166
|
+
version: 0.5.5845
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: yard
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: 0.9.16
|
160
174
|
type: :runtime
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
180
|
+
version: 0.9.16
|
167
181
|
description: 'A YARD plugin that incorporates Sorbet type information
|
168
182
|
|
169
183
|
'
|
@@ -172,24 +186,13 @@ executables: []
|
|
172
186
|
extensions: []
|
173
187
|
extra_rdoc_files: []
|
174
188
|
files:
|
175
|
-
- ".editorconfig"
|
176
|
-
- ".gitignore"
|
177
|
-
- ".rspec"
|
178
|
-
- ".rubocop.yml"
|
179
|
-
- ".travis.yml"
|
180
|
-
- ".yardopts"
|
181
|
-
- CHANGELOG.md
|
182
|
-
- Gemfile
|
183
189
|
- LICENSE
|
184
|
-
- README.md
|
185
|
-
- Rakefile
|
186
190
|
- lib/yard-sorbet.rb
|
187
191
|
- lib/yard-sorbet/directives.rb
|
188
192
|
- lib/yard-sorbet/sig_handler.rb
|
189
193
|
- lib/yard-sorbet/sig_to_yard.rb
|
190
194
|
- lib/yard-sorbet/struct_handler.rb
|
191
195
|
- lib/yard-sorbet/version.rb
|
192
|
-
- yard-sorbet.gemspec
|
193
196
|
homepage: https://github.com/dduugg/yard-sorbet
|
194
197
|
licenses:
|
195
198
|
- Apache-2.0
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
|
-
/tmp/
|
12
|
-
|
13
|
-
# Used by dotenv library to load environment variables.
|
14
|
-
# .env
|
15
|
-
|
16
|
-
# Ignore Byebug command history file.
|
17
|
-
.byebug_history
|
18
|
-
|
19
|
-
## Documentation cache and generated files:
|
20
|
-
/.yardoc/
|
21
|
-
/_yardoc/
|
22
|
-
/doc/
|
23
|
-
/rdoc/
|
24
|
-
|
25
|
-
## Environment normalization:
|
26
|
-
/.bundle/
|
27
|
-
/vendor/bundle
|
28
|
-
/lib/bundler/man/
|
29
|
-
|
30
|
-
# for a library or gem, you might want to ignore these files since the code is
|
31
|
-
# intended to run in multiple environments; otherwise, check them in:
|
32
|
-
Gemfile.lock
|
33
|
-
.ruby-version
|
34
|
-
.ruby-gemset
|
35
|
-
|
36
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
-
.rvmrc
|
38
|
-
|
39
|
-
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
40
|
-
# .rubocop-https?--*
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
---
|
2
|
-
require:
|
3
|
-
- rubocop-rake
|
4
|
-
- rubocop-rspec
|
5
|
-
- rubocop-sorbet
|
6
|
-
|
7
|
-
AllCops:
|
8
|
-
NewCops: enable
|
9
|
-
TargetRubyVersion: 2.5
|
10
|
-
|
11
|
-
Layout/ClassStructure:
|
12
|
-
Enabled: true
|
13
|
-
# doesn't recognize sorbet magic comments
|
14
|
-
Layout/EmptyLineAfterMagicComment:
|
15
|
-
Enabled: false
|
16
|
-
Layout/LineLength:
|
17
|
-
Enabled: false
|
18
|
-
Metrics/AbcSize:
|
19
|
-
Enabled: false
|
20
|
-
Metrics/BlockLength:
|
21
|
-
Enabled: false
|
22
|
-
Metrics/BlockNesting:
|
23
|
-
Enabled: false
|
24
|
-
Metrics/ClassLength:
|
25
|
-
Enabled: false
|
26
|
-
Metrics/CyclomaticComplexity:
|
27
|
-
Enabled: false
|
28
|
-
Metrics/MethodLength:
|
29
|
-
Enabled: false
|
30
|
-
Metrics/PerceivedComplexity:
|
31
|
-
Enabled: false
|
32
|
-
Naming/FileName:
|
33
|
-
Exclude:
|
34
|
-
- lib/yard-sorbet.rb
|
35
|
-
RSpec/EmptyExampleGroup:
|
36
|
-
Enabled: false
|
37
|
-
RSpec/ExampleLength:
|
38
|
-
Enabled: false
|
39
|
-
RSpec/MultipleExpectations:
|
40
|
-
Enabled: false
|
41
|
-
Sorbet/EnforceSignatures:
|
42
|
-
Enabled: false
|
43
|
-
Sorbet/StrictSigil:
|
44
|
-
Enabled: false
|
45
|
-
Sorbet/StrongSigil:
|
46
|
-
Enabled: false
|
47
|
-
Sorbet/TrueSigil:
|
48
|
-
Exclude:
|
49
|
-
- lib/yard-sorbet/struct_handler.rb
|
50
|
-
- spec/**/*
|
51
|
-
Style/AccessModifierDeclarations:
|
52
|
-
EnforcedStyle: inline
|
53
|
-
Style/ClassAndModuleChildren:
|
54
|
-
EnforcedStyle: compact
|
55
|
-
Style/NegatedIf:
|
56
|
-
Enabled: false
|
57
|
-
Style/NegatedWhile:
|
58
|
-
Enabled: false
|
59
|
-
Style/Next:
|
60
|
-
Enabled: false
|
61
|
-
Style/IfUnlessModifier:
|
62
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/.yardopts
DELETED
data/CHANGELOG.md
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# Change log
|
2
|
-
|
3
|
-
## master (unreleased)
|
4
|
-
|
5
|
-
## 0.1.0 (2020-12-01)
|
6
|
-
|
7
|
-
### New features
|
8
|
-
|
9
|
-
* [#8](https://github.com/dduugg/yard-sorbet/pull/8): Add support for singleton class syntax.
|
10
|
-
* [#7](https://github.com/dduugg/yard-sorbet/pull/7): Add support for top-level constants in sigs.
|
11
|
-
|
12
|
-
### Bug fixes
|
13
|
-
|
14
|
-
* [#9](https://github.com/dduugg/yard-sorbet/pull/9): Remove warning for use of `T.attached_class`.
|
15
|
-
* [#11](https://github.com/dduugg/yard-sorbet/pull/11): Fix parsing of custom parameterized types.
|
16
|
-
* [#12](https://github.com/dduugg/yard-sorbet/pull/12): Fix parsing of recursive custom parameterized types.
|
17
|
-
|
18
|
-
### Changes
|
19
|
-
|
20
|
-
* [#10](https://github.com/dduugg/yard-sorbet/pull/10): Downgrade log level of unsupported `sig` `aref` nodes.
|
21
|
-
* Drop Ruby 2.4 support
|
22
|
-
|
23
|
-
## 0.0.1 (2020-01-24)
|
24
|
-
|
25
|
-
* [#1](https://github.com/dduugg/yard-sorbet/pull/1): Add `T::Struct` support.
|
26
|
-
* [#3](https://github.com/dduugg/yard-sorbet/pull/3): Rename require path to be conistent with gem name.
|
27
|
-
|
28
|
-
## 0.0.0 (2020-01-05)
|
29
|
-
|
30
|
-
* Initial Release
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# yard-sorbet
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/yard-sorbet.svg)](https://badge.fury.io/rb/yard-sorbet)
|
3
|
-
[![Build Status](https://travis-ci.com/dduugg/yard-sorbet.svg?branch=master)](https://travis-ci.com/dduugg/yard-sorbet)
|
4
|
-
[![codecov](https://codecov.io/gh/dduugg/yard-sorbet/branch/master/graph/badge.svg)](https://codecov.io/gh/dduugg/yard-sorbet)
|
5
|
-
|
6
|
-
A YARD [plugin](https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#Plugin_Support) that parses Sorbet type annotations
|
7
|
-
|
8
|
-
## Install
|
9
|
-
|
10
|
-
```shell
|
11
|
-
gem install yard-sorbet
|
12
|
-
```
|
13
|
-
|
14
|
-
## Usage
|
15
|
-
```bash
|
16
|
-
yard doc --plugin sorbet
|
17
|
-
```
|
data/Rakefile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# typed: strong
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/gem_tasks'
|
5
|
-
require 'rspec/core/rake_task'
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
|
9
|
-
desc 'Lint files with Rubocop'
|
10
|
-
task :lint do
|
11
|
-
sh 'rubocop'
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Typecheck files with Sorbet'
|
15
|
-
task :typecheck do
|
16
|
-
sh 'srb tc --ignore=vendor/'
|
17
|
-
end
|
18
|
-
|
19
|
-
task default: %i[lint spec typecheck]
|
data/yard-sorbet.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# typed: strong
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require_relative 'lib/yard-sorbet/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'yard-sorbet'
|
8
|
-
spec.version = YARDSorbet::VERSION
|
9
|
-
spec.author = 'Douglas Eichelberger'
|
10
|
-
spec.email = 'dduugg@gmail.com'
|
11
|
-
spec.license = 'Apache-2.0'
|
12
|
-
|
13
|
-
spec.summary = 'Create YARD docs from Sorbet type signatures'
|
14
|
-
spec.description = <<~DESC
|
15
|
-
A YARD plugin that incorporates Sorbet type information
|
16
|
-
DESC
|
17
|
-
spec.homepage = 'https://github.com/dduugg/yard-sorbet'
|
18
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
19
|
-
|
20
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
-
spec.metadata['source_code_uri'] = spec.homepage
|
22
|
-
spec.metadata['changelog_uri'] = 'https://github.com/dduugg/yard-sorbet/blob/master/CHANGELOG.md'
|
23
|
-
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(sorbet|spec)/}) }
|
26
|
-
end
|
27
|
-
|
28
|
-
spec.add_development_dependency 'codecov', '~> 0.2.12'
|
29
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
30
|
-
spec.add_development_dependency 'rspec', '~> 3.10'
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 1.5.0'
|
32
|
-
spec.add_development_dependency 'rubocop-rake', '~> 0.5.1'
|
33
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.0.0'
|
34
|
-
spec.add_development_dependency 'rubocop-sorbet', '~> 0.5.1'
|
35
|
-
spec.add_development_dependency 'simplecov', '~> 0.20.0'
|
36
|
-
spec.add_development_dependency 'sorbet', '~> 0.5.6083'
|
37
|
-
spec.add_runtime_dependency 'sorbet-runtime', '>= 0.5'
|
38
|
-
spec.add_runtime_dependency 'yard', '>= 0.9'
|
39
|
-
end
|