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.
@@ -0,0 +1,66 @@
1
+ # Generated from lib/sigmold/typecheck.rb with RBS::Inline
2
+
3
+ module Sigmold
4
+ # Type checks a project the way its Steepfile says and hands back each
5
+ # Ruby file's typing. It drives Steep's type check service, which is not a
6
+ # public API, so this file is the one place that touches it.
7
+ class Typecheck
8
+ # One Ruby file Steep checked: its typing, and every diagnostic at every
9
+ # level. A Steepfile may hide a diagnostic as a hint; sigmold still sees it.
10
+ class Checked < Data
11
+ attr_reader path(): String
12
+
13
+ attr_reader text(): String
14
+
15
+ attr_reader typing(): untyped
16
+
17
+ attr_reader target(): untyped
18
+
19
+ def self.new: (String path, String text, untyped typing, untyped target) -> instance
20
+ | (path: String, text: String, typing: untyped, target: untyped) -> instance
21
+
22
+ def self.members: () -> [ :path, :text, :typing, :target ]
23
+
24
+ def members: () -> [ :path, :text, :typing, :target ]
25
+ end
26
+
27
+ attr_reader root: String
28
+
29
+ attr_reader project: untyped
30
+
31
+ attr_reader service: untyped
32
+
33
+ # @rbs root: String
34
+ def initialize: (String root) -> void
35
+
36
+ # The Ruby files the Steepfile checks.
37
+ #
38
+ # @rbs return: Array[Checked]
39
+ def sources: () -> Array[Checked]
40
+
41
+ # The signature folders the Steepfile names, relative to the root.
42
+ #
43
+ # @rbs return: Array[String]
44
+ def signature_dirs: () -> Array[String]
45
+
46
+ # The Ruby folders the Steepfile checks, relative to the root.
47
+ #
48
+ # @rbs return: Array[String]
49
+ def source_dirs: () -> Array[String]
50
+
51
+ # The type environment at one position, as the editor's hover sees it.
52
+ #
53
+ # @rbs checked: Checked
54
+ # @rbs position: Integer
55
+ # @rbs return: untyped
56
+ def context_at: (Checked checked, Integer position) -> untyped
57
+
58
+ private
59
+
60
+ # A Steepfile may name a signature folder outside the project, such as a
61
+ # gem's own sig/ beside an example, so the folders come from it.
62
+ #
63
+ # @rbs return: Hash[Pathname, untyped]
64
+ def changes: () -> Hash[Pathname, untyped]
65
+ end
66
+ end
@@ -0,0 +1,5 @@
1
+ # Generated from lib/sigmold/version.rb with RBS::Inline
2
+
3
+ module Sigmold
4
+ VERSION: String
5
+ end
@@ -0,0 +1,135 @@
1
+ # Generated from lib/sigmold.rb with RBS::Inline
2
+
3
+ module Sigmold
4
+ # One implementation of the class, loaded under a module of its own so
5
+ # several versions of the same file live in one process.
6
+ class Impl
7
+ attr_reader label: String
8
+
9
+ attr_reader klass: untyped
10
+
11
+ # +root+ is the top-level module the file opens, such as "QuintDriver";
12
+ # +const+ is the class path below it, such as "Hold".
13
+ #
14
+ # @rbs label: String
15
+ # @rbs path: String
16
+ # @rbs root: String
17
+ # @rbs const: String
18
+ def initialize: (String label, String path, root: String, const: String) -> void
19
+
20
+ # An error message names the module it was raised in; take that off so
21
+ # two implementations compare by what they say.
22
+ #
23
+ # @rbs value: untyped
24
+ # @rbs return: untyped
25
+ def plain: (untyped value) -> untyped
26
+ end
27
+
28
+ # Where two implementations first disagree on one operation sequence.
29
+ class Difference < Data
30
+ attr_reader key(): String
31
+
32
+ attr_reader ops(): Array[untyped]
33
+
34
+ attr_reader seen(): Hash[String, untyped]
35
+
36
+ def self.new: (String key, Array[untyped] ops, Hash[String, untyped] seen) -> instance
37
+ | (key: String, ops: Array[untyped], seen: Hash[String, untyped]) -> instance
38
+
39
+ def self.members: () -> [ :key, :ops, :seen ]
40
+
41
+ def members: () -> [ :key, :ops, :seen ]
42
+ end
43
+
44
+ # Runs an explorer against implementations and collects the differences.
45
+ class Comparison
46
+ # @rbs explorer: untyped
47
+ # @rbs impls: Array[Impl]
48
+ # @rbs free: Array[String]
49
+ def initialize: (untyped explorer, Array[Impl] impls, ?free: Array[String]) -> void
50
+
51
+ # Groups by key; each group keeps its shortest shrunk case.
52
+ #
53
+ # @rbs runs: Integer
54
+ # @rbs seed: Integer
55
+ # @rbs return: Hash[String, Array[Difference]]
56
+ def run: (runs: Integer, seed: Integer) -> Hash[String, Array[Difference]]
57
+
58
+ # @rbs ops: Array[untyped]
59
+ # @rbs return: Difference?
60
+ def differ: (Array[untyped] ops) -> Difference?
61
+
62
+ private
63
+
64
+ # @rbs impl: Impl
65
+ # @rbs ops: Array[untyped]
66
+ # @rbs return: untyped
67
+ def observe: (Impl impl, Array[untyped] ops) -> untyped
68
+
69
+ # The key names the first step where the observations part, and which
70
+ # implementations agree there, so one key is one question for the owner.
71
+ #
72
+ # @rbs seen: Hash[String, untyped]
73
+ # @rbs return: String
74
+ def key_of: (Hash[String, untyped] seen) -> String
75
+
76
+ # Drops operations one at a time while the same difference remains.
77
+ #
78
+ # @rbs diff: Difference
79
+ # @rbs return: Difference
80
+ def shrink: (Difference diff) -> Difference
81
+ end
82
+
83
+ # The key of a step whose argument could not be built (Explore#label).
84
+ FOLLOWS: ::String
85
+
86
+ # Writes the report: one section per key, most frequent first, with the
87
+ # shrunk operations and what each implementation did.
88
+ #
89
+ # @rbs found: Hash[String, Array[Difference]]
90
+ # @rbs impls: Array[Impl]
91
+ # @rbs runs: Integer
92
+ # @rbs explorer: untyped
93
+ # @rbs return: String
94
+ def self.report: (Hash[String, Array[Difference]] found, Array[Impl] impls, runs: Integer, ?explorer: untyped) -> String
95
+
96
+ # One question as its owner reads it: the calls, what each version did,
97
+ # and the test that makes each answer the contract, or the line that
98
+ # leaves it free. Each step is the same up to the last call, so only the
99
+ # last call's outcome differs.
100
+ #
101
+ # @rbs calls: Array[String]
102
+ # @rbs seen: Hash[String, untyped]
103
+ # @rbs key: String
104
+ # @rbs impls: Array[Impl]
105
+ # @rbs also: Array[String] -- runs the same split stops, already worded
106
+ # @rbs return: Array[String]
107
+ def self.question: (Array[String] calls, Hash[String, untyped] seen, String key, Array[Impl] impls, ?also: Array[String]) -> Array[String]
108
+
109
+ # @rbs call: String -- the last line as describe wrote it
110
+ # @rbs expr: String -- that line without an assignment
111
+ # @rbs seen: untyped
112
+ # @rbs return: String
113
+ def self.assertion: (String call, String expr, untyped seen) -> String
114
+
115
+ # A value a test can write as a literal. An object of the namespace is
116
+ # observed as its class name and readers, which is no literal.
117
+ #
118
+ # @rbs value: untyped
119
+ def self.plain?: (untyped value, ?top: untyped) -> bool
120
+
121
+ # The last step of an observation, as a person reads it.
122
+ #
123
+ # @rbs seen: untyped
124
+ # @rbs return: String
125
+ def self.outcome: (untyped seen) -> String
126
+
127
+ # The first label is the original. When every rewrite agrees and only the
128
+ # original differs, the original may hold an accident; when rewrites
129
+ # disagree with each other, the spec is open.
130
+ #
131
+ # @rbs key: String
132
+ # @rbs impls: Array[Impl]
133
+ # @rbs return: String
134
+ def self.triage: (String key, Array[Impl] impls) -> String
135
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sigmold
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - meganemura
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ executables:
13
+ - sigmold
14
+ extensions: []
15
+ extra_rdoc_files: []
16
+ files:
17
+ - CHANGELOG.md
18
+ - LICENSE
19
+ - README.ja.md
20
+ - README.md
21
+ - exe/sigmold
22
+ - lib/sigmold.rb
23
+ - lib/sigmold/calls.rb
24
+ - lib/sigmold/calls_recorder.rb
25
+ - lib/sigmold/check.rb
26
+ - lib/sigmold/deps.rb
27
+ - lib/sigmold/explore.rb
28
+ - lib/sigmold/hole.rb
29
+ - lib/sigmold/holes.rb
30
+ - lib/sigmold/pour.rb
31
+ - lib/sigmold/review.rb
32
+ - lib/sigmold/signature.rb
33
+ - lib/sigmold/strict.rb
34
+ - lib/sigmold/surface.rb
35
+ - lib/sigmold/surface_check.rb
36
+ - lib/sigmold/typecheck.rb
37
+ - lib/sigmold/version.rb
38
+ - sig/generated/sigmold.rbs
39
+ - sig/generated/sigmold/calls.rbs
40
+ - sig/generated/sigmold/calls_recorder.rbs
41
+ - sig/generated/sigmold/check.rbs
42
+ - sig/generated/sigmold/deps.rbs
43
+ - sig/generated/sigmold/explore.rbs
44
+ - sig/generated/sigmold/hole.rbs
45
+ - sig/generated/sigmold/holes.rbs
46
+ - sig/generated/sigmold/pour.rbs
47
+ - sig/generated/sigmold/review.rbs
48
+ - sig/generated/sigmold/signature.rbs
49
+ - sig/generated/sigmold/strict.rbs
50
+ - sig/generated/sigmold/surface.rbs
51
+ - sig/generated/sigmold/surface_check.rbs
52
+ - sig/generated/sigmold/typecheck.rbs
53
+ - sig/generated/sigmold/version.rbs
54
+ homepage: https://github.com/meganemura/sigmold
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ source_code_uri: https://github.com/meganemura/sigmold
59
+ changelog_uri: https://github.com/meganemura/sigmold/blob/main/CHANGELOG.md
60
+ bug_tracker_uri: https://github.com/meganemura/sigmold/issues
61
+ rubygems_mfa_required: 'true'
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '3.3'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubygems_version: 4.0.16
77
+ specification_version: 4
78
+ summary: Shape a Ruby class in RBS and tests first, and find where the shape does
79
+ not yet decide the code
80
+ test_files: []