sigmold 0.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 +7 -0
- data/CHANGELOG.md +19 -0
- data/LICENSE +21 -0
- data/README.ja.md +136 -0
- data/README.md +128 -0
- data/exe/sigmold +174 -0
- data/lib/sigmold/calls.rb +75 -0
- data/lib/sigmold/calls_recorder.rb +65 -0
- data/lib/sigmold/check.rb +78 -0
- data/lib/sigmold/deps.rb +60 -0
- data/lib/sigmold/explore.rb +443 -0
- data/lib/sigmold/hole.rb +30 -0
- data/lib/sigmold/holes.rb +85 -0
- data/lib/sigmold/pour.rb +100 -0
- data/lib/sigmold/review.rb +127 -0
- data/lib/sigmold/signature.rb +151 -0
- data/lib/sigmold/strict.rb +159 -0
- data/lib/sigmold/surface.rb +54 -0
- data/lib/sigmold/surface_check.rb +59 -0
- data/lib/sigmold/typecheck.rb +88 -0
- data/lib/sigmold/version.rb +6 -0
- data/lib/sigmold.rb +308 -0
- data/sig/generated/sigmold/calls.rbs +47 -0
- data/sig/generated/sigmold/calls_recorder.rbs +22 -0
- data/sig/generated/sigmold/check.rbs +39 -0
- data/sig/generated/sigmold/deps.rbs +30 -0
- data/sig/generated/sigmold/explore.rbs +181 -0
- data/sig/generated/sigmold/hole.rbs +24 -0
- data/sig/generated/sigmold/holes.rbs +56 -0
- data/sig/generated/sigmold/pour.rbs +60 -0
- data/sig/generated/sigmold/review.rbs +58 -0
- data/sig/generated/sigmold/signature.rbs +105 -0
- data/sig/generated/sigmold/strict.rbs +96 -0
- data/sig/generated/sigmold/surface.rbs +20 -0
- data/sig/generated/sigmold/surface_check.rbs +36 -0
- data/sig/generated/sigmold/typecheck.rbs +66 -0
- data/sig/generated/sigmold/version.rbs +5 -0
- data/sig/generated/sigmold.rbs +135 -0
- metadata +80 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Generated from lib/sigmold/explore.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# An explorer built from a class's signature, so `gaps` needs no explorer
|
|
5
|
+
# written by hand. It makes one instance with `new`, then calls the
|
|
6
|
+
# public instance methods with values drawn from their parameter types,
|
|
7
|
+
# and observes each return value, each raised error, and each block call.
|
|
8
|
+
#
|
|
9
|
+
# Values stay plain data in the plan (a class in the namespace is a
|
|
10
|
+
# `[:build, name, args, keywords]` node), so a plan prints, shrinks, and
|
|
11
|
+
# replays on every implementation the same way. A method whose parameter
|
|
12
|
+
# type it cannot draw is left out and named in +skipped+.
|
|
13
|
+
class Explore
|
|
14
|
+
# Text is drawn from pieces, so spaces, runs of spaces, newlines, long
|
|
15
|
+
# words, and the empty string all come up.
|
|
16
|
+
PIECES: untyped
|
|
17
|
+
|
|
18
|
+
SYMBOLS: untyped
|
|
19
|
+
|
|
20
|
+
# A type variable stands for keys and names more often than for
|
|
21
|
+
# numbers, and two names must sometimes collide.
|
|
22
|
+
VARIABLES: untyped
|
|
23
|
+
|
|
24
|
+
DEPTH: ::Integer
|
|
25
|
+
|
|
26
|
+
attr_reader skipped: Array[String]
|
|
27
|
+
|
|
28
|
+
# The steps the signature leaves free, such as "new -> raises
|
|
29
|
+
# ArgumentError": `%a{sigmold:free: <step>}` above the class, or
|
|
30
|
+
# `%a{sigmold:free: <outcome>}` on a method, such as "returns".
|
|
31
|
+
attr_reader free: Array[String]
|
|
32
|
+
|
|
33
|
+
FREE: ::String
|
|
34
|
+
|
|
35
|
+
# +const+ is the class to explore under its full name, such as
|
|
36
|
+
# "Shop::Cart"; +root+ is the module the implementation file opens.
|
|
37
|
+
#
|
|
38
|
+
# @rbs signature: Signature
|
|
39
|
+
# @rbs const: String
|
|
40
|
+
# @rbs root: String
|
|
41
|
+
# @rbs length: Range[Integer]
|
|
42
|
+
# @rbs messages: bool
|
|
43
|
+
def initialize: (Signature signature, String const, root: String, ?length: Range[Integer], ?messages: bool) -> void
|
|
44
|
+
|
|
45
|
+
# @rbs random: Random
|
|
46
|
+
# @rbs return: Array[untyped]
|
|
47
|
+
def plan: (Random random) -> Array[untyped]
|
|
48
|
+
|
|
49
|
+
# One entry per operation: what it returned or raised, and what the
|
|
50
|
+
# block it was given saw.
|
|
51
|
+
#
|
|
52
|
+
# @rbs klass: untyped
|
|
53
|
+
# @rbs ops: Array[untyped]
|
|
54
|
+
# @rbs return: Array[untyped]
|
|
55
|
+
def run: (untyped klass, Array[untyped] ops) -> Array[untyped]
|
|
56
|
+
|
|
57
|
+
# Shrinking keeps the call that makes the object: without it every
|
|
58
|
+
# later call would fail on nil, which says nothing about the class.
|
|
59
|
+
#
|
|
60
|
+
# @rbs op: Array[untyped]
|
|
61
|
+
def kept?: (Array[untyped] op) -> bool
|
|
62
|
+
|
|
63
|
+
# @rbs step: untyped
|
|
64
|
+
def telling?: (untyped step) -> bool
|
|
65
|
+
|
|
66
|
+
# Each operation is a step, so a key names the first call that parts.
|
|
67
|
+
#
|
|
68
|
+
# @rbs observation: Array[untyped]
|
|
69
|
+
# @rbs return: Array[untyped]
|
|
70
|
+
def steps: (Array[untyped] observation) -> Array[untyped]
|
|
71
|
+
|
|
72
|
+
# @rbs step: untyped
|
|
73
|
+
# @rbs return: String
|
|
74
|
+
def label: (untyped step) -> String
|
|
75
|
+
|
|
76
|
+
# The operations as Ruby a person reads, one call per line.
|
|
77
|
+
#
|
|
78
|
+
# @rbs ops: Array[untyped]
|
|
79
|
+
# @rbs return: Array[String]
|
|
80
|
+
def describe: (Array[untyped] ops) -> Array[String]
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
# @rbs node: untyped
|
|
85
|
+
# @rbs me: String
|
|
86
|
+
# @rbs return: String
|
|
87
|
+
def ruby: (untyped node, String me) -> String
|
|
88
|
+
|
|
89
|
+
# A call the block makes on the object, without a block of its own.
|
|
90
|
+
#
|
|
91
|
+
# @rbs random: Random
|
|
92
|
+
# @rbs return: Array[untyped]?
|
|
93
|
+
def inner_call: (Random random) -> Array[untyped]?
|
|
94
|
+
|
|
95
|
+
# An instance method's operation is its Symbol, a singleton method's
|
|
96
|
+
# its String, so one plan holds both.
|
|
97
|
+
#
|
|
98
|
+
# @rbs entry: Signature::Entry
|
|
99
|
+
# @rbs return: Symbol | String
|
|
100
|
+
def op_name: (Signature::Entry entry) -> (Symbol | String)
|
|
101
|
+
|
|
102
|
+
# @rbs owner: String
|
|
103
|
+
# @rbs return: Array[Symbol]
|
|
104
|
+
def readers_of: (String owner) -> Array[Symbol]
|
|
105
|
+
|
|
106
|
+
# @rbs type: untyped
|
|
107
|
+
def drawable?: (untyped type) -> bool
|
|
108
|
+
|
|
109
|
+
# @rbs type: untyped
|
|
110
|
+
# @rbs depth: Integer
|
|
111
|
+
def draw?: (untyped type, Integer depth) -> bool
|
|
112
|
+
|
|
113
|
+
# @rbs type: untyped
|
|
114
|
+
# @rbs random: Random
|
|
115
|
+
# @rbs return: [Array[untyped], Hash[String, untyped], untyped]
|
|
116
|
+
def arguments: (untyped type, Random random) -> [ Array[untyped], Hash[String, untyped], untyped ]
|
|
117
|
+
|
|
118
|
+
# @rbs type: untyped
|
|
119
|
+
# @rbs random: Random
|
|
120
|
+
# @rbs depth: Integer
|
|
121
|
+
# @rbs return: untyped
|
|
122
|
+
def draw: (untyped type, Random random, Integer depth) -> untyped
|
|
123
|
+
|
|
124
|
+
# @rbs type: untyped
|
|
125
|
+
# @rbs random: Random
|
|
126
|
+
# @rbs return: untyped
|
|
127
|
+
def base: (untyped type, Random random) -> untyped
|
|
128
|
+
|
|
129
|
+
# @rbs type: untyped
|
|
130
|
+
# @rbs random: Random
|
|
131
|
+
# @rbs depth: Integer
|
|
132
|
+
# @rbs return: untyped
|
|
133
|
+
def generic: (untyped type, Random random, Integer depth) -> untyped
|
|
134
|
+
|
|
135
|
+
# @rbs type: untyped
|
|
136
|
+
# @rbs random: Random
|
|
137
|
+
# @rbs depth: Integer
|
|
138
|
+
# @rbs return: untyped
|
|
139
|
+
def build_node: (untyped type, Random random, Integer depth) -> untyped
|
|
140
|
+
|
|
141
|
+
BASE: untyped
|
|
142
|
+
|
|
143
|
+
# @rbs type: untyped
|
|
144
|
+
# @rbs return: Symbol
|
|
145
|
+
def kind: (untyped type) -> Symbol
|
|
146
|
+
|
|
147
|
+
# @rbs type: untyped
|
|
148
|
+
# @rbs return: String
|
|
149
|
+
def name_of: (untyped type) -> String
|
|
150
|
+
|
|
151
|
+
# @rbs type: untyped
|
|
152
|
+
# @rbs return: Array[untyped]
|
|
153
|
+
def params_of: (untyped type) -> Array[untyped]
|
|
154
|
+
|
|
155
|
+
# @rbs name: String
|
|
156
|
+
def in_root?: (String name) -> bool
|
|
157
|
+
|
|
158
|
+
# Turns plan data into values for one implementation. `[:subject]`
|
|
159
|
+
# stands for the instance under test, where a parameter wants one.
|
|
160
|
+
#
|
|
161
|
+
# @rbs node: untyped
|
|
162
|
+
# @rbs resolve: ^(String) -> untyped
|
|
163
|
+
# @rbs subject: untyped
|
|
164
|
+
# @rbs return: untyped
|
|
165
|
+
def build: (untyped node, ^(String) -> untyped resolve, untyped subject) -> untyped
|
|
166
|
+
|
|
167
|
+
# @rbs subject: untyped
|
|
168
|
+
# @rbs &block: () -> untyped
|
|
169
|
+
# @rbs return: Array[untyped]
|
|
170
|
+
def attempt: (untyped subject) { () -> untyped } -> Array[untyped]
|
|
171
|
+
|
|
172
|
+
# A plain value both implementations can be compared by. An object of
|
|
173
|
+
# the namespace shows its class and its public readers when it is Data.
|
|
174
|
+
#
|
|
175
|
+
# @rbs value: untyped
|
|
176
|
+
# @rbs subject: untyped
|
|
177
|
+
# @rbs depth: Integer
|
|
178
|
+
# @rbs return: untyped
|
|
179
|
+
def observe: (untyped value, untyped subject, ?Integer depth) -> untyped
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated from lib/sigmold/hole.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# The type of a hole. No other type accepts it, so Steep names the type
|
|
5
|
+
# each hole must become ("Cannot allow method body have type ::Sigmold::Hole
|
|
6
|
+
# because declared as type ::Integer"), where `raise NotImplementedError`
|
|
7
|
+
# would pass in silence.
|
|
8
|
+
class Hole
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Write `Sigmold.hole("name")` where code is still to be poured in.
|
|
12
|
+
#
|
|
13
|
+
# @rbs name: String
|
|
14
|
+
# @rbs return: Hole
|
|
15
|
+
def self.hole: (?String name) -> Hole
|
|
16
|
+
|
|
17
|
+
# Put it in the `else` of a `case/when` that names every case. When a case
|
|
18
|
+
# is left, Steep names its type ("Cannot pass a value of type ::Tri as an
|
|
19
|
+
# argument of type bot"). Steep does not type `case/in`, so use `case/when`.
|
|
20
|
+
#
|
|
21
|
+
# @rbs value: bot
|
|
22
|
+
# @rbs return: bot
|
|
23
|
+
def self.absurd: (bot value) -> bot
|
|
24
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated from lib/sigmold/holes.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Lists the holes of a project, each with the type it must become and the
|
|
5
|
+
# local variables in scope there, as Steep infers them.
|
|
6
|
+
module Holes
|
|
7
|
+
class Found < Data
|
|
8
|
+
attr_reader path(): String
|
|
9
|
+
|
|
10
|
+
attr_reader line(): Integer
|
|
11
|
+
|
|
12
|
+
attr_reader name(): String
|
|
13
|
+
|
|
14
|
+
attr_reader wanted(): String?
|
|
15
|
+
|
|
16
|
+
attr_reader locals(): Hash[String, String]
|
|
17
|
+
|
|
18
|
+
attr_reader self_type(): String
|
|
19
|
+
|
|
20
|
+
def self.new: (String path, Integer line, String name, String? wanted, Hash[String, String] locals, String self_type) -> instance
|
|
21
|
+
| (path: String, line: Integer, name: String, wanted: String?, locals: Hash[String, String], self_type: String) -> instance
|
|
22
|
+
|
|
23
|
+
def self.members: () -> [ :path, :line, :name, :wanted, :locals, :self_type ]
|
|
24
|
+
|
|
25
|
+
def members: () -> [ :path, :line, :name, :wanted, :locals, :self_type ]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @rbs root: String
|
|
29
|
+
# @rbs return: Array[Found]
|
|
30
|
+
def self.find: (String root) -> Array[Found]
|
|
31
|
+
|
|
32
|
+
# @rbs check: Typecheck
|
|
33
|
+
# @rbs return: Array[Found]
|
|
34
|
+
def self.within: (Typecheck check) -> Array[Found]
|
|
35
|
+
|
|
36
|
+
# `Sigmold.hole(...)` or a bare `hole(...)`.
|
|
37
|
+
#
|
|
38
|
+
# @rbs node: untyped
|
|
39
|
+
def self.hole_call?: (untyped node) -> bool
|
|
40
|
+
|
|
41
|
+
# @rbs error: untyped
|
|
42
|
+
# @rbs range: untyped
|
|
43
|
+
def self.covers?: (untyped error, untyped range) -> bool
|
|
44
|
+
|
|
45
|
+
# @rbs found: Array[Found]
|
|
46
|
+
# @rbs return: String
|
|
47
|
+
def self.report: (Array[Found] found) -> String
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Walks a Parser AST, which Steep's typing holds.
|
|
51
|
+
module Nodes
|
|
52
|
+
# @rbs node: untyped
|
|
53
|
+
# @rbs return: Array[untyped]
|
|
54
|
+
def self.each: (untyped node) -> Array[untyped]
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Generated from lib/sigmold/pour.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Has an agent write a file again from the mold alone: the checkout
|
|
5
|
+
# without the file, its signature cut to the public surface, and the
|
|
6
|
+
# tests. Each copy is a rewrite `gaps` can compare with the original.
|
|
7
|
+
module Pour
|
|
8
|
+
class Rewrite < Data
|
|
9
|
+
attr_reader label(): String
|
|
10
|
+
|
|
11
|
+
attr_reader dir(): String
|
|
12
|
+
|
|
13
|
+
attr_reader path(): String
|
|
14
|
+
|
|
15
|
+
attr_reader written(): bool
|
|
16
|
+
|
|
17
|
+
attr_reader tests(): bool?
|
|
18
|
+
|
|
19
|
+
attr_reader kept(): bool
|
|
20
|
+
|
|
21
|
+
def self.new: (String label, String dir, String path, bool written, bool? tests, bool kept) -> instance
|
|
22
|
+
| (label: String, dir: String, path: String, written: bool, tests: bool?, kept: bool) -> instance
|
|
23
|
+
|
|
24
|
+
def self.members: () -> [ :label, :dir, :path, :written, :tests, :kept ]
|
|
25
|
+
|
|
26
|
+
def members: () -> [ :label, :dir, :path, :written, :tests, :kept ]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Copies +files+ from the current folder into +into+, leaves +file+
|
|
30
|
+
# out, and cuts +sig+ to its public surface.
|
|
31
|
+
#
|
|
32
|
+
# @rbs file: String
|
|
33
|
+
# @rbs sig: String
|
|
34
|
+
# @rbs into: String
|
|
35
|
+
# @rbs files: Array[String]
|
|
36
|
+
def self.hide: (String file, String sig, String into, files: Array[String]) -> void
|
|
37
|
+
|
|
38
|
+
# Runs +agent+, a shell command, once per rewrite in a folder of its
|
|
39
|
+
# own under +out+. The brief goes to its standard input and to
|
|
40
|
+
# SIGMOLD_BRIEF. +test+, a shell command, runs after it in that folder.
|
|
41
|
+
#
|
|
42
|
+
# @rbs file: String
|
|
43
|
+
# @rbs sig: String
|
|
44
|
+
# @rbs agent: String
|
|
45
|
+
# @rbs out: String
|
|
46
|
+
# @rbs files: Array[String]
|
|
47
|
+
# @rbs times: Integer
|
|
48
|
+
# @rbs test: String?
|
|
49
|
+
# @rbs return: Array[Rewrite]
|
|
50
|
+
def self.run: (file: String, sig: String, agent: String, out: untyped, files: Array[String], ?times: Integer, ?test: String?) -> Array[Rewrite]
|
|
51
|
+
|
|
52
|
+
# @rbs path: String
|
|
53
|
+
# @rbs return: String
|
|
54
|
+
def self.clean: (String path) -> String
|
|
55
|
+
|
|
56
|
+
# @rbs rewrites: Array[Rewrite]
|
|
57
|
+
# @rbs return: String
|
|
58
|
+
def self.report: (Array[Rewrite] rewrites) -> String
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Generated from lib/sigmold/review.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Shows what a person reviews between two commits: the public part of the
|
|
5
|
+
# signatures and the tests. The code, and the private parts an agent
|
|
6
|
+
# declared for it, are named but not shown, because `check` and `pour`
|
|
7
|
+
# hold them to the mold.
|
|
8
|
+
module Review
|
|
9
|
+
# @rbs base: String
|
|
10
|
+
# @rbs head: String? -- nil reads the working tree
|
|
11
|
+
# @rbs sig: Array[String]
|
|
12
|
+
# @rbs tests: Array[String]
|
|
13
|
+
# @rbs lib: String
|
|
14
|
+
# @rbs return: String
|
|
15
|
+
def self.report: (base: String, ?head: String?, ?sig: Array[String], ?tests: Array[String], ?lib: String) -> String
|
|
16
|
+
|
|
17
|
+
# The dependencies the public signatures name that came or went, as
|
|
18
|
+
# `+ A -> B`, so a reviewer sees a new edge before the code that uses it.
|
|
19
|
+
#
|
|
20
|
+
# @rbs before: Hash[String, String]
|
|
21
|
+
# @rbs after: Hash[String, String]
|
|
22
|
+
# @rbs return: String
|
|
23
|
+
def self.uses: (Hash[String, String] before, Hash[String, String] after) -> String
|
|
24
|
+
|
|
25
|
+
# @rbs sig: Hash[String, String]
|
|
26
|
+
# @rbs return: Array[String]
|
|
27
|
+
def self.edges: (Hash[String, String] sig) -> Array[String]
|
|
28
|
+
|
|
29
|
+
# @rbs title: String
|
|
30
|
+
# @rbs text: String
|
|
31
|
+
# @rbs return: String
|
|
32
|
+
def self.section: (String title, String text) -> String
|
|
33
|
+
|
|
34
|
+
# The text of each file under +dirs+ at +rev+, or in the working tree.
|
|
35
|
+
#
|
|
36
|
+
# @rbs rev: String?
|
|
37
|
+
# @rbs dirs: Array[String]
|
|
38
|
+
# @rbs return: Hash[String, String]
|
|
39
|
+
def self.files: (String? rev, Array[String] dirs) -> Hash[String, String]
|
|
40
|
+
|
|
41
|
+
# @rbs before: Hash[String, String]
|
|
42
|
+
# @rbs after: Hash[String, String]
|
|
43
|
+
# @rbs return: Array[String]
|
|
44
|
+
def self.changed: (Hash[String, String] before, Hash[String, String] after) -> Array[String]
|
|
45
|
+
|
|
46
|
+
# A unified diff between two sets of files, with paths as the project
|
|
47
|
+
# names them.
|
|
48
|
+
#
|
|
49
|
+
# @rbs before: Hash[String, String]
|
|
50
|
+
# @rbs after: Hash[String, String]
|
|
51
|
+
# @rbs return: String
|
|
52
|
+
def self.diff: (Hash[String, String] before, Hash[String, String] after) -> String
|
|
53
|
+
|
|
54
|
+
# @rbs args: String
|
|
55
|
+
# @rbs return: String
|
|
56
|
+
def self.git: (*untyped args) -> String
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Generated from lib/sigmold/signature.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Reads the public surface of a namespace from its RBS files: the methods a
|
|
5
|
+
# reader of sig/ sees, each with its method types. `surface`, `calls`,
|
|
6
|
+
# `strict`, and the explorer that `gaps` builds all start from this one
|
|
7
|
+
# reading, so they agree on what "declared" means. It loads the `rbs` gem
|
|
8
|
+
# when called, because sigmold has no runtime dependency.
|
|
9
|
+
class Signature
|
|
10
|
+
# One public method a signature declares. +id+ is `A::B#name` for an
|
|
11
|
+
# instance method and `A::B.name` for a singleton method.
|
|
12
|
+
class Entry < Data
|
|
13
|
+
attr_reader id(): String
|
|
14
|
+
|
|
15
|
+
attr_reader owner(): String
|
|
16
|
+
|
|
17
|
+
attr_reader name(): Symbol
|
|
18
|
+
|
|
19
|
+
attr_reader singleton(): bool
|
|
20
|
+
|
|
21
|
+
attr_reader types(): Array[untyped]
|
|
22
|
+
|
|
23
|
+
attr_reader annotations(): Array[String]
|
|
24
|
+
|
|
25
|
+
attr_reader location(): String?
|
|
26
|
+
|
|
27
|
+
def self.new: (String id, String owner, Symbol name, bool singleton, Array[untyped] types, Array[String] annotations, String? location) -> instance
|
|
28
|
+
| (id: String, owner: String, name: Symbol, singleton: bool, types: Array[untyped], annotations: Array[String], location: String?) -> instance
|
|
29
|
+
|
|
30
|
+
def self.members: () -> [ :id, :owner, :name, :singleton, :types, :annotations, :location ]
|
|
31
|
+
|
|
32
|
+
def members: () -> [ :id, :owner, :name, :singleton, :types, :annotations, :location ]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
attr_reader env: untyped
|
|
36
|
+
|
|
37
|
+
attr_reader builder: untyped
|
|
38
|
+
|
|
39
|
+
# @rbs dirs: Array[String]
|
|
40
|
+
def initialize: (Array[String] dirs) -> void
|
|
41
|
+
|
|
42
|
+
# The modules and classes the signatures declare under +namespace+,
|
|
43
|
+
# the namespace included, as names without the leading `::`.
|
|
44
|
+
#
|
|
45
|
+
# @rbs namespace: String
|
|
46
|
+
# @rbs return: Array[String]
|
|
47
|
+
def modules: (String namespace) -> Array[String]
|
|
48
|
+
|
|
49
|
+
# The modules and classes declared in the given folders themselves, not
|
|
50
|
+
# in the core library the loader adds.
|
|
51
|
+
#
|
|
52
|
+
# @rbs return: Array[String]
|
|
53
|
+
def own_modules: () -> Array[String]
|
|
54
|
+
|
|
55
|
+
# Whether a method is declared in the given folders, not in the core
|
|
56
|
+
# library a project's signature reopens.
|
|
57
|
+
#
|
|
58
|
+
# @rbs entry: Entry
|
|
59
|
+
def own?: (Entry entry) -> bool
|
|
60
|
+
|
|
61
|
+
# The annotations written above a class or module, in every file
|
|
62
|
+
# that opens it.
|
|
63
|
+
#
|
|
64
|
+
# @rbs name: String
|
|
65
|
+
# @rbs return: Array[String]
|
|
66
|
+
def annotations_of: (String name) -> Array[String]
|
|
67
|
+
|
|
68
|
+
# @rbs name: String
|
|
69
|
+
def class_named?: (String name) -> bool
|
|
70
|
+
|
|
71
|
+
# @rbs name: String
|
|
72
|
+
def declared?: (String name) -> bool
|
|
73
|
+
|
|
74
|
+
# Every public method declared under +namespace+. `new` counts as
|
|
75
|
+
# declared unless the signature makes it private, because every class
|
|
76
|
+
# answers it.
|
|
77
|
+
#
|
|
78
|
+
# @rbs namespace: String
|
|
79
|
+
# @rbs return: Array[Entry]
|
|
80
|
+
def surface: (String namespace) -> Array[Entry]
|
|
81
|
+
|
|
82
|
+
# @rbs owner: String
|
|
83
|
+
# @rbs return: Array[Entry]
|
|
84
|
+
def entries: (String owner) -> Array[Entry]
|
|
85
|
+
|
|
86
|
+
# Methods the signature declares private, under the same ids.
|
|
87
|
+
#
|
|
88
|
+
# @rbs namespace: String
|
|
89
|
+
# @rbs return: Array[String]
|
|
90
|
+
def private_ids: (String namespace) -> Array[String]
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
# @rbs name: String
|
|
95
|
+
# @rbs return: untyped
|
|
96
|
+
def type_name: (String name) -> untyped
|
|
97
|
+
|
|
98
|
+
# @rbs entry: untyped
|
|
99
|
+
# @rbs return: Array[untyped]
|
|
100
|
+
def decls: (untyped entry) -> Array[untyped]
|
|
101
|
+
|
|
102
|
+
# @rbs kind: untyped
|
|
103
|
+
def class?: (untyped kind) -> bool
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Generated from lib/sigmold/strict.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Finds the ways code can pass Steep without meeting its signature, so a
|
|
5
|
+
# clean check means the types hold. A reviewer who reads only sig/ and the
|
|
6
|
+
# tests relies on that.
|
|
7
|
+
#
|
|
8
|
+
# - Every Steep diagnostic counts, at any level. A Steepfile's defaults
|
|
9
|
+
# show `case/in` (UnsupportedSyntax) and a node Steep gave up on
|
|
10
|
+
# (UnexpectedError) only as hints, and their bodies go unchecked.
|
|
11
|
+
# - A type comment that says `untyped`, or a `steep:ignore`, turns the
|
|
12
|
+
# check off where it stands.
|
|
13
|
+
# - `untyped` in a public signature lets any value through. One the owner
|
|
14
|
+
# chose carries `%a{sigmold:untyped}`, so the choice is visible in sig/.
|
|
15
|
+
#
|
|
16
|
+
# A diagnostic on a hole belongs to `sigmold holes`, not here.
|
|
17
|
+
module Strict
|
|
18
|
+
class Finding < Data
|
|
19
|
+
attr_reader path(): String
|
|
20
|
+
|
|
21
|
+
attr_reader line(): Integer
|
|
22
|
+
|
|
23
|
+
attr_reader rule(): String
|
|
24
|
+
|
|
25
|
+
attr_reader message(): String
|
|
26
|
+
|
|
27
|
+
def self.new: (String path, Integer line, String rule, String message) -> instance
|
|
28
|
+
| (path: String, line: Integer, rule: String, message: String) -> instance
|
|
29
|
+
|
|
30
|
+
def self.members: () -> [ :path, :line, :rule, :message ]
|
|
31
|
+
|
|
32
|
+
def members: () -> [ :path, :line, :rule, :message ]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
ALLOW: ::String
|
|
36
|
+
|
|
37
|
+
# @rbs root: String
|
|
38
|
+
# @rbs return: Array[Finding]
|
|
39
|
+
def self.find: (String root) -> Array[Finding]
|
|
40
|
+
|
|
41
|
+
# @rbs check: Typecheck
|
|
42
|
+
# @rbs return: Array[Finding]
|
|
43
|
+
def self.within: (Typecheck check) -> Array[Finding]
|
|
44
|
+
|
|
45
|
+
# @rbs checked: Typecheck::Checked
|
|
46
|
+
# @rbs return: Array[Finding]
|
|
47
|
+
def self.diagnostics: (Typecheck::Checked checked) -> Array[Finding]
|
|
48
|
+
|
|
49
|
+
# A diagnostic belongs to a hole when it stands inside the hole call,
|
|
50
|
+
# or when the value it judges is the hole itself: the body a hole ends,
|
|
51
|
+
# an argument it fills, a method called on it. A diagnostic that only
|
|
52
|
+
# encloses a hole, such as a body whose other branch has a wrong type,
|
|
53
|
+
# still counts.
|
|
54
|
+
#
|
|
55
|
+
# @rbs error: untyped
|
|
56
|
+
# @rbs holes: Array[untyped]
|
|
57
|
+
def self.hole_made?: (untyped error, Array[untyped] holes) -> bool
|
|
58
|
+
|
|
59
|
+
HOLE: ::String
|
|
60
|
+
|
|
61
|
+
ATTRIBUTES: Hash[Symbol, Array[String]]
|
|
62
|
+
|
|
63
|
+
# Steep does not count `attr_reader :name` in Ruby as the method an RBS
|
|
64
|
+
# `attr_reader name: T` declares, and says the method is missing.
|
|
65
|
+
#
|
|
66
|
+
# @rbs error: untyped
|
|
67
|
+
def self.attribute?: (untyped error) -> bool
|
|
68
|
+
|
|
69
|
+
# The methods the attr_ calls directly in a class body define, not
|
|
70
|
+
# those of a class nested in it. Steep's own nodes, such as a type
|
|
71
|
+
# assertion, sit among the parser's and are passed over.
|
|
72
|
+
#
|
|
73
|
+
# @rbs node: untyped
|
|
74
|
+
# @rbs top: bool
|
|
75
|
+
# @rbs return: Array[String]
|
|
76
|
+
def self.attributes: (untyped node, ?top: bool) -> Array[String]
|
|
77
|
+
|
|
78
|
+
# @rbs checked: Typecheck::Checked
|
|
79
|
+
# @rbs return: Array[Finding]
|
|
80
|
+
def self.comments: (Typecheck::Checked checked) -> Array[Finding]
|
|
81
|
+
|
|
82
|
+
# @rbs dirs: Array[String]
|
|
83
|
+
# @rbs root: String
|
|
84
|
+
# @rbs return: Array[Finding]
|
|
85
|
+
def self.signatures: (Array[String] dirs, String root) -> Array[Finding]
|
|
86
|
+
|
|
87
|
+
# @rbs path: String
|
|
88
|
+
# @rbs root: String
|
|
89
|
+
# @rbs return: String
|
|
90
|
+
def self.relative: (String path, String root) -> String
|
|
91
|
+
|
|
92
|
+
# @rbs found: Array[Finding]
|
|
93
|
+
# @rbs return: String
|
|
94
|
+
def self.report: (Array[Finding] found) -> String
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generated from lib/sigmold/surface.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Cuts an RBS file down to what callers see, so the rewriting agent does
|
|
5
|
+
# not inherit the original's private shape, and writes its brief.
|
|
6
|
+
module Surface
|
|
7
|
+
# Drops instance variable declarations and everything after a bare
|
|
8
|
+
# `private` line in each class body. A `private def` line goes too.
|
|
9
|
+
#
|
|
10
|
+
# @rbs rbs: String
|
|
11
|
+
# @rbs return: String
|
|
12
|
+
def self.public_only: (String rbs) -> String
|
|
13
|
+
|
|
14
|
+
# @rbs file: String
|
|
15
|
+
# @rbs sig: String
|
|
16
|
+
# @rbs into: String
|
|
17
|
+
# @rbs return: String
|
|
18
|
+
def self.brief: (String file, String sig, String into) -> String
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/sigmold/surface_check.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Sigmold
|
|
4
|
+
# Compares the public methods a loaded namespace has with the public
|
|
5
|
+
# methods its signatures declare, so a reader of sig/ sees every entry
|
|
6
|
+
# point and only those. A method counts on the Ruby side only when its
|
|
7
|
+
# source is under +lib+, which leaves out what Struct and Data define.
|
|
8
|
+
module SurfaceCheck
|
|
9
|
+
class Gap < Data
|
|
10
|
+
attr_reader method(): String
|
|
11
|
+
|
|
12
|
+
attr_reader where(): :only_in_lib | :only_in_sig
|
|
13
|
+
|
|
14
|
+
def self.new: (String method, :only_in_lib | :only_in_sig where) -> instance
|
|
15
|
+
| (method: String, where: :only_in_lib | :only_in_sig) -> instance
|
|
16
|
+
|
|
17
|
+
def self.members: () -> [ :method, :where ]
|
|
18
|
+
|
|
19
|
+
def members: () -> [ :method, :where ]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @rbs namespace: Module
|
|
23
|
+
# @rbs sig: Array[String]
|
|
24
|
+
# @rbs lib: String
|
|
25
|
+
# @rbs return: Array[Gap]
|
|
26
|
+
def self.gaps: (Module namespace, sig: Array[String], lib: String) -> Array[Gap]
|
|
27
|
+
|
|
28
|
+
# @rbs gaps: Array[Gap]
|
|
29
|
+
# @rbs return: String
|
|
30
|
+
def self.report: (Array[Gap] gaps) -> String
|
|
31
|
+
|
|
32
|
+
# @rbs mod: Module
|
|
33
|
+
# @rbs return: Array[Module]
|
|
34
|
+
def self.modules: (Module mod, ?untyped seen) -> Array[Module]
|
|
35
|
+
end
|
|
36
|
+
end
|