nukadoko 0.1.0 → 0.2.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/CHANGELOG.md +291 -0
- data/README.ja.md +58 -5
- data/README.md +15 -3
- data/exe/nuka +8 -0
- data/lib/nukadoko/aria_snapshot.rb +1008 -0
- data/lib/nukadoko/aria_tree.rb +150 -0
- data/lib/nukadoko/base.rb +274 -0
- data/lib/nukadoko/check.rb +669 -22
- data/lib/nukadoko/claim_check.rb +177 -0
- data/lib/nukadoko/claim_check_run.rb +293 -0
- data/lib/nukadoko/claim_line.rb +381 -0
- data/lib/nukadoko/claim_rules.rb +519 -0
- data/lib/nukadoko/claims.rb +407 -30
- data/lib/nukadoko/cli.rb +802 -19
- data/lib/nukadoko/codes.json +942 -0
- data/lib/nukadoko/codes.rb +19 -0
- data/lib/nukadoko/command.rb +214 -12
- data/lib/nukadoko/criteria.rb +172 -0
- data/lib/nukadoko/definition.rb +33 -41
- data/lib/nukadoko/env_check.rb +90 -0
- data/lib/nukadoko/features.rb +80 -10
- data/lib/nukadoko/fixtures.rb +296 -10
- data/lib/nukadoko/http_recording.rb +68 -0
- data/lib/nukadoko/init.rb +130 -0
- data/lib/nukadoko/judge.rb +221 -0
- data/lib/nukadoko/judgment_file.rb +78 -0
- data/lib/nukadoko/judgments.rb +256 -0
- data/lib/nukadoko/literal.rb +129 -0
- data/lib/nukadoko/measured.rb +105 -0
- data/lib/nukadoko/order.rb +84 -0
- data/lib/nukadoko/parts.rb +42 -21
- data/lib/nukadoko/pattern.rb +11 -1
- data/lib/nukadoko/poll.rb +17 -6
- data/lib/nukadoko/program.rb +105 -17
- data/lib/nukadoko/project_fixtures.rb +17 -2
- data/lib/nukadoko/report_allure.rb +751 -0
- data/lib/nukadoko/report_messages.rb +167 -0
- data/lib/nukadoko/report_run.rb +169 -0
- data/lib/nukadoko/run.rb +865 -88
- data/lib/nukadoko/run_record.rb +532 -0
- data/lib/nukadoko/scaffold.rb +1015 -0
- data/lib/nukadoko/schema.rb +61 -4
- data/lib/nukadoko/secrets.rb +359 -0
- data/lib/nukadoko/selection.rb +163 -0
- data/lib/nukadoko/signature.rb +4 -1
- data/lib/nukadoko/skill.rb +36 -0
- data/lib/nukadoko/step.rb +62 -21
- data/lib/nukadoko/summary.rb +662 -0
- data/lib/nukadoko/table.rb +34 -2
- data/lib/nukadoko/text_fit.rb +179 -0
- data/lib/nukadoko/trace.rb +244 -0
- data/lib/nukadoko/trace_actions.rb +116 -0
- data/lib/nukadoko/tree_passes.rb +119 -0
- data/lib/nukadoko/verdict.rb +128 -0
- data/lib/nukadoko/version.rb +2 -1
- data/lib/nukadoko/vocabulary.rb +6 -0
- data/lib/nukadoko/walk.rb +305 -0
- data/lib/nukadoko/walk_files.rb +473 -0
- data/lib/nukadoko/walk_step.rb +149 -0
- data/lib/nukadoko.rb +36 -0
- data/llms.txt +296 -0
- data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
- data/sig/generated/nukadoko/aria_tree.rbs +142 -0
- data/sig/generated/nukadoko/base.rbs +136 -0
- data/sig/generated/nukadoko/check.rbs +255 -0
- data/sig/generated/nukadoko/claim_check.rbs +118 -0
- data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
- data/sig/generated/nukadoko/claim_line.rbs +158 -0
- data/sig/generated/nukadoko/claim_rules.rbs +172 -0
- data/sig/generated/nukadoko/claims.rbs +165 -0
- data/sig/generated/nukadoko/cli.rbs +182 -0
- data/sig/generated/nukadoko/codes.rbs +16 -0
- data/sig/generated/nukadoko/command.rbs +109 -0
- data/sig/generated/nukadoko/criteria.rbs +83 -0
- data/sig/generated/nukadoko/definition.rbs +30 -0
- data/sig/generated/nukadoko/env_check.rbs +38 -0
- data/sig/generated/nukadoko/features.rbs +101 -0
- data/sig/generated/nukadoko/fixtures.rbs +152 -0
- data/sig/generated/nukadoko/http_recording.rbs +29 -0
- data/sig/generated/nukadoko/init.rbs +66 -0
- data/sig/generated/nukadoko/judge.rbs +64 -0
- data/sig/generated/nukadoko/judgment_file.rbs +39 -0
- data/sig/generated/nukadoko/judgments.rbs +120 -0
- data/sig/generated/nukadoko/literal.rbs +71 -0
- data/sig/generated/nukadoko/measured.rbs +42 -0
- data/sig/generated/nukadoko/order.rbs +54 -0
- data/sig/generated/nukadoko/parts.rbs +35 -0
- data/sig/generated/nukadoko/pattern.rbs +28 -0
- data/sig/generated/nukadoko/poll.rbs +40 -0
- data/sig/generated/nukadoko/program.rbs +101 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
- data/sig/generated/nukadoko/report_allure.rbs +268 -0
- data/sig/generated/nukadoko/report_messages.rbs +68 -0
- data/sig/generated/nukadoko/report_run.rbs +102 -0
- data/sig/generated/nukadoko/run.rbs +257 -0
- data/sig/generated/nukadoko/run_record.rbs +174 -0
- data/sig/generated/nukadoko/scaffold.rbs +328 -0
- data/sig/generated/nukadoko/schema.rbs +137 -0
- data/sig/generated/nukadoko/secrets.rbs +157 -0
- data/sig/generated/nukadoko/selection.rbs +73 -0
- data/sig/generated/nukadoko/signature.rbs +17 -0
- data/sig/generated/nukadoko/skill.rbs +20 -0
- data/sig/generated/nukadoko/step.rbs +115 -0
- data/sig/generated/nukadoko/summary.rbs +204 -0
- data/sig/generated/nukadoko/table.rbs +43 -0
- data/sig/generated/nukadoko/text_fit.rbs +70 -0
- data/sig/generated/nukadoko/trace.rbs +127 -0
- data/sig/generated/nukadoko/trace_actions.rbs +40 -0
- data/sig/generated/nukadoko/tree_passes.rbs +48 -0
- data/sig/generated/nukadoko/verdict.rbs +56 -0
- data/sig/generated/nukadoko/version.rbs +5 -0
- data/sig/generated/nukadoko/vocabulary.rbs +25 -0
- data/sig/generated/nukadoko/walk.rbs +139 -0
- data/sig/generated/nukadoko/walk_files.rbs +189 -0
- data/sig/generated/nukadoko/walk_step.rbs +50 -0
- data/sig/generated/nukadoko.rbs +15 -0
- data/sig/nukadoko.rbs +5 -48
- data/skills/nukadoko/SKILL.md +120 -0
- data/skills/nukadoko/references/checking-steps.md +200 -0
- data/skills/nukadoko/references/diagnosing.md +200 -0
- data/skills/nukadoko/references/done.md +99 -0
- data/skills/nukadoko/references/evidence.md +124 -0
- data/skills/nukadoko/references/examples/cli.md +230 -0
- data/skills/nukadoko/references/examples/http-api.md +339 -0
- data/skills/nukadoko/references/examples/workflow.md +173 -0
- data/skills/nukadoko/references/exploring.md +184 -0
- data/skills/nukadoko/references/fixtures.md +198 -0
- data/skills/nukadoko/references/from-prose.md +51 -0
- data/skills/nukadoko/references/judgments.md +95 -0
- data/skills/nukadoko/references/maintenance.md +97 -0
- data/skills/nukadoko/references/merge-risk.md +74 -0
- data/skills/nukadoko/references/parts.md +152 -0
- data/skills/nukadoko/references/perturbed-worlds.md +107 -0
- data/skills/nukadoko/references/program.md +200 -0
- data/skills/nukadoko/references/reviewing.md +200 -0
- data/skills/nukadoko/references/running.md +200 -0
- data/skills/nukadoko/references/scenario-rules.md +188 -0
- data/skills/nukadoko/references/states.md +66 -0
- data/skills/nukadoko/references/step-files.md +200 -0
- data/skills/nukadoko/references/verdicts.md +200 -0
- data/skills/nukadoko/references/writing-steps.md +200 -0
- data/skills/nukadoko/references/writing-the-feature.md +165 -0
- data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
- data/skills/nukadoko/scripts/merge-risk.jq +56 -0
- data/skills/nukadoko-verification/SKILL.md +263 -0
- metadata +121 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/aria_snapshot.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# What an ARIA snapshot says, and whether an expected one fits an actual
|
|
4
|
+
# one (`fits-aria-snapshot`), in the TypeScript engine's words. An ARIA
|
|
5
|
+
# snapshot is the YAML text a browser library prints for a page's
|
|
6
|
+
# accessibility tree: a list of nodes, each a role with an optional name
|
|
7
|
+
# and states, its text, and its children. This module reads two such
|
|
8
|
+
# texts, the one nukadoko took (the actual side) and the docstring a line
|
|
9
|
+
# states (the expected side), and judges whether every node the expected
|
|
10
|
+
# side names is in the actual tree, at the place it names it, leaving the
|
|
11
|
+
# rest of the tree unasked. For a broken claim it names the first expected
|
|
12
|
+
# node that fits nothing and the actual node nearest to it.
|
|
13
|
+
#
|
|
14
|
+
# It is pure: it never touches a page. The claim judges the text the
|
|
15
|
+
# runner took, so the record shows the one value that was judged, and a
|
|
16
|
+
# reader can judge the record again from its two texts alone. That is why
|
|
17
|
+
# the matching reads the printed text and not the browser's own tree: a
|
|
18
|
+
# state the print leaves out (an unchecked box prints no `[checked]`) is
|
|
19
|
+
# absent here too, so `[checked=false]` holds on any node that prints no
|
|
20
|
+
# checked state.
|
|
21
|
+
#
|
|
22
|
+
# The reader takes the part of YAML an ARIA snapshot uses: a block list of
|
|
23
|
+
# items, each a key alone or one key with a text or a list of children,
|
|
24
|
+
# plain, single-quoted, or double-quoted scalars, and comments. Anything
|
|
25
|
+
# else is refused with its line, and the refusal says how to write what
|
|
26
|
+
# the line meant. On the expected side a pattern between slashes, the
|
|
27
|
+
# state `[active]`, and a `/` property at the top of a list that names one
|
|
28
|
+
# node are refused too, since nukadoko would otherwise accept a line it
|
|
29
|
+
# does not judge.
|
|
30
|
+
module Nukadoko
|
|
31
|
+
module Engine
|
|
32
|
+
module AriaSnapshot
|
|
33
|
+
FRAGMENT: ::String
|
|
34
|
+
|
|
35
|
+
# JavaScript's \s, which the TypeScript engine's texts are cut by.
|
|
36
|
+
SPACE: ::String
|
|
37
|
+
|
|
38
|
+
WS: ::Regexp
|
|
39
|
+
|
|
40
|
+
# YAML's indicators: a plain scalar may not start with one, since
|
|
41
|
+
# YAML reads it as structure.
|
|
42
|
+
PLAIN_START_REFUSED: untyped
|
|
43
|
+
|
|
44
|
+
DOUBLE_QUOTED_ESCAPES: untyped
|
|
45
|
+
|
|
46
|
+
HEX_ESCAPE_LENGTH: untyped
|
|
47
|
+
|
|
48
|
+
# What YAML's core schema reads a plain scalar as when it is not a
|
|
49
|
+
# string: a writer who means the text "3.50" and writes it plain gets
|
|
50
|
+
# the number 3.5, so such a value is refused, not read as other text.
|
|
51
|
+
YAML_NULL: ::Regexp
|
|
52
|
+
|
|
53
|
+
YAML_BOOLEAN: ::Regexp
|
|
54
|
+
|
|
55
|
+
YAML_NUMBER: ::Regexp
|
|
56
|
+
|
|
57
|
+
STATE_NAMES: untyped
|
|
58
|
+
|
|
59
|
+
PRINTED_STATE: ::Regexp
|
|
60
|
+
|
|
61
|
+
SOURCE_LIMIT: ::Integer
|
|
62
|
+
|
|
63
|
+
# The most actual lines an excerpt shows.
|
|
64
|
+
EXCERPT_LINES: ::Integer
|
|
65
|
+
|
|
66
|
+
# : (Integer, String) -> Problem
|
|
67
|
+
def self?.problem_at: (Integer, String) -> Problem
|
|
68
|
+
|
|
69
|
+
# : (String) -> String
|
|
70
|
+
def self?.trim: (String) -> String
|
|
71
|
+
|
|
72
|
+
# : (String) -> String
|
|
73
|
+
def self?.trim_end: (String) -> String
|
|
74
|
+
|
|
75
|
+
# : (String?) -> bool
|
|
76
|
+
def self?.space?: (String?) -> bool
|
|
77
|
+
|
|
78
|
+
# : (String) -> Array[Line]
|
|
79
|
+
def self?.content_lines: (String) -> Array[Line]
|
|
80
|
+
|
|
81
|
+
# A quoted scalar at `start` of `text`: its value and the index after
|
|
82
|
+
# its closing quote.
|
|
83
|
+
# : (String, Integer, Integer) -> [String, Integer]
|
|
84
|
+
def self?.read_quoted: (String, Integer, Integer) -> [ String, Integer ]
|
|
85
|
+
|
|
86
|
+
# A code point as text; a lone surrogate, which a Ruby string cannot
|
|
87
|
+
# hold, is the replacement character.
|
|
88
|
+
# : (Integer) -> String
|
|
89
|
+
def self?.code_point: (Integer) -> String
|
|
90
|
+
|
|
91
|
+
# Where a plain scalar that starts at `start` ends: before a `:` that
|
|
92
|
+
# a space or the end follows, when `key` is true, or before a ` #`
|
|
93
|
+
# comment either way.
|
|
94
|
+
# : (String, Integer, bool) -> Integer
|
|
95
|
+
def self?.plain_end: (String, Integer, bool) -> Integer
|
|
96
|
+
|
|
97
|
+
# : (String, Integer, bool, Integer) -> [Scalar, Integer]
|
|
98
|
+
def self?.read_scalar: (String, Integer, bool, Integer) -> [ Scalar, Integer ]
|
|
99
|
+
|
|
100
|
+
# : (String, Integer) -> Integer
|
|
101
|
+
def self?.skip_spaces: (String, Integer) -> Integer
|
|
102
|
+
|
|
103
|
+
# The rest of a line after a scalar may hold only spaces and a comment.
|
|
104
|
+
# : (String, Integer) -> bool
|
|
105
|
+
def self?.ends_here?: (String, Integer) -> bool
|
|
106
|
+
|
|
107
|
+
# One item's content after `- `: its key, whether a colon follows
|
|
108
|
+
# it, its text when one does, and the item as written.
|
|
109
|
+
# : (String, Integer) -> [Scalar, bool, Scalar?, String]
|
|
110
|
+
def self?.read_entry: (String, Integer) -> [ Scalar, bool, Scalar?, String ]
|
|
111
|
+
|
|
112
|
+
# : (Array[Line], Integer, Integer) -> [Array[Item], Integer]
|
|
113
|
+
def self?.read_list: (Array[Line], Integer, Integer) -> [ Array[Item], Integer ]
|
|
114
|
+
|
|
115
|
+
# : (String) -> Array[Item]
|
|
116
|
+
def self?.read_items: (String) -> Array[Item]
|
|
117
|
+
|
|
118
|
+
# The text a plain scalar on the expected side states, or why YAML
|
|
119
|
+
# reads it as something else. A number or a boolean whose own text
|
|
120
|
+
# YAML gives back unchanged (`42`, `true`) states that text.
|
|
121
|
+
# : (Scalar, Integer, String) -> String
|
|
122
|
+
def self?.stated_text: (Scalar, Integer, String) -> String
|
|
123
|
+
|
|
124
|
+
# The text of the number YAML reads a plain scalar as, spelled as
|
|
125
|
+
# JavaScript spells a number, since the TypeScript engine's messages
|
|
126
|
+
# name it so.
|
|
127
|
+
# : (String) -> String
|
|
128
|
+
def self?.yaml_number_text: (String) -> String
|
|
129
|
+
|
|
130
|
+
# A float as JavaScript's Number#toString writes it: its shortest
|
|
131
|
+
# digits, as a plain number from 1e-7 to 1e21, and with an exponent
|
|
132
|
+
# outside that.
|
|
133
|
+
# : (Float) -> String
|
|
134
|
+
def self?.js_number: (Float) -> String
|
|
135
|
+
|
|
136
|
+
# White space folded the way the snapshot folds a page's text.
|
|
137
|
+
# : (String) -> String
|
|
138
|
+
def self?.folded: (String) -> String
|
|
139
|
+
|
|
140
|
+
# : (String) -> ExpectedText
|
|
141
|
+
def self?.expected_text: (String) -> ExpectedText
|
|
142
|
+
|
|
143
|
+
# A key's role, name, and states, read the way a docstring writes
|
|
144
|
+
# them: a role, then a name in double quotes, then states in brackets.
|
|
145
|
+
# : (String, Integer) -> [String, String, Hash[String, untyped]]
|
|
146
|
+
def self?.expected_key: (String, Integer) -> [ String, String, Hash[String, untyped] ]
|
|
147
|
+
|
|
148
|
+
# : (Hash[String, untyped], String, String, Integer) -> void
|
|
149
|
+
def self?.apply_state: (Hash[String, untyped], String, String, Integer) -> void
|
|
150
|
+
|
|
151
|
+
# The children a list of items names, into `container`, with the
|
|
152
|
+
# first property item at the top kept in `first_prop`.
|
|
153
|
+
# : (Array[Item], Node, ?Hash[Symbol, Item]) -> void
|
|
154
|
+
def self?.expected_children: (Array[Item], Node, ?Hash[Symbol, Item]) -> void
|
|
155
|
+
|
|
156
|
+
# : (Item, String, String, Hash[String, untyped], Array[Node]) -> Node
|
|
157
|
+
def self?.role_node: (Item, String, String, Hash[String, untyped], Array[Node]) -> Node
|
|
158
|
+
|
|
159
|
+
# The tree a docstring states: [root, named], where root is the node
|
|
160
|
+
# the matching searches for (a fragment when it names several at the
|
|
161
|
+
# top, or states a children mode there) and named how many nodes it
|
|
162
|
+
# names; or a String saying why it reads as no snapshot.
|
|
163
|
+
# : (String) -> ([Node, Integer] | String)
|
|
164
|
+
def self?.read_expected: (String) -> ([ Node, Integer ] | String)
|
|
165
|
+
|
|
166
|
+
# The properties a node states that a page could lack: each one
|
|
167
|
+
# whose text is not empty, since an empty text fits any text.
|
|
168
|
+
# : (Hash[String, untyped]) -> Integer
|
|
169
|
+
def self?.stated_props: (Hash[String, untyped]) -> Integer
|
|
170
|
+
|
|
171
|
+
# The nodes a list names that a page could lack: every role, and
|
|
172
|
+
# every text that is not empty.
|
|
173
|
+
# : (Array[Node]) -> Integer
|
|
174
|
+
def self?.count_named: (Array[Node]) -> Integer
|
|
175
|
+
|
|
176
|
+
# A key as the snapshot prints it: a role, then a name as a JSON
|
|
177
|
+
# string, or as it is when it starts and ends with a slash, then its
|
|
178
|
+
# states.
|
|
179
|
+
# : (String, Integer) -> [String, String, Hash[String, untyped]]
|
|
180
|
+
def self?.actual_key: (String, Integer) -> [ String, String, Hash[String, untyped] ]
|
|
181
|
+
|
|
182
|
+
# : (Array[Item], Node) -> void
|
|
183
|
+
def self?.actual_children: (Array[Item], Node) -> void
|
|
184
|
+
|
|
185
|
+
# The tree a printed snapshot shows, under a node of role `fragment`
|
|
186
|
+
# that holds its list, or a String saying why it does not read. A
|
|
187
|
+
# plain scalar is the text it spells: the printer quotes every text
|
|
188
|
+
# YAML would read otherwise.
|
|
189
|
+
# : (String) -> (Node | String)
|
|
190
|
+
def self?.read_actual: (String) -> (Node | String)
|
|
191
|
+
|
|
192
|
+
# : (String?, ExpectedText) -> bool
|
|
193
|
+
def self?.text_fits?: (String?, ExpectedText) -> bool
|
|
194
|
+
|
|
195
|
+
# : (String, Hash[String, untyped], Hash[String, untyped]) -> bool
|
|
196
|
+
def self?.state_fits?: (String, Hash[String, untyped], Hash[String, untyped]) -> bool
|
|
197
|
+
|
|
198
|
+
# Whether `actual` is the node `expected` names, by its own line
|
|
199
|
+
# alone: its role, name, states, and properties, and for a text, its
|
|
200
|
+
# text.
|
|
201
|
+
# : (Node, Node) -> bool
|
|
202
|
+
def self?.node_fits?: (Node, Node) -> bool
|
|
203
|
+
|
|
204
|
+
# How `expected`'s children are read, as [contain, deep]: its own mode
|
|
205
|
+
# wins, and under a `deep-equal` above it, every list is read whole.
|
|
206
|
+
# : (Node, bool) -> [bool, bool]
|
|
207
|
+
def self?.children_reading: (Node, bool) -> [ bool, bool ]
|
|
208
|
+
|
|
209
|
+
# : (Node, Node, bool) -> bool
|
|
210
|
+
def self?.tree_fits?: (Node, Node, bool) -> bool
|
|
211
|
+
|
|
212
|
+
# : (Node) -> Array[Node]
|
|
213
|
+
def self?.every_node: (Node) -> Array[Node]
|
|
214
|
+
|
|
215
|
+
# : (Node) -> Array[Node]
|
|
216
|
+
def self?.below: (Node) -> Array[Node]
|
|
217
|
+
|
|
218
|
+
# Whether the tree an expected snapshot names is in the actual tree:
|
|
219
|
+
# its top node fits some actual node at any depth, each of its
|
|
220
|
+
# children fits a child of that node, in order, with other children
|
|
221
|
+
# between them unasked, and so on down, unless a `/children` mode
|
|
222
|
+
# asks for every child.
|
|
223
|
+
# : (Node, Node) -> bool
|
|
224
|
+
def self?.snapshot_fits?: (Node, Node) -> bool
|
|
225
|
+
|
|
226
|
+
# The text an expected line states after its key (`- listitem: one`),
|
|
227
|
+
# which the line reads as part of the node it names.
|
|
228
|
+
# : (Node) -> ExpectedText?
|
|
229
|
+
def self?.inline_text: (Node) -> ExpectedText?
|
|
230
|
+
|
|
231
|
+
# Whether `actual` is the node an expected line names, its inline
|
|
232
|
+
# text included.
|
|
233
|
+
# : (Node, Node) -> bool
|
|
234
|
+
def self?.line_fits?: (Node, Node) -> bool
|
|
235
|
+
|
|
236
|
+
# The edit distance between two texts, each cut to its first 200
|
|
237
|
+
# characters, so a long name costs no more than a short one.
|
|
238
|
+
# : (String, String) -> Integer
|
|
239
|
+
def self?.edit_distance: (String, String) -> Integer
|
|
240
|
+
|
|
241
|
+
# Of `candidates`, the one most like `expected`: a node of its role,
|
|
242
|
+
# or a text for a text, whose name or text is nearest to the one it
|
|
243
|
+
# states, the earliest of equals; nil when none is of its role.
|
|
244
|
+
# : (Node, Array[Node]) -> Node?
|
|
245
|
+
def self?.most_alike: (Node, Array[Node]) -> Node?
|
|
246
|
+
|
|
247
|
+
# A misfit where an expected node fits nothing: where it was looked
|
|
248
|
+
# for (nil for anywhere), the nearest actual node, and the place the
|
|
249
|
+
# previous sibling left it.
|
|
250
|
+
# : (Node, Node?, Node, ?Node?, ?Array[Node]) -> Hash[Symbol, untyped]
|
|
251
|
+
def self?.unmatched: (Node, Node?, Node, ?Node?, ?Array[Node]) -> Hash[Symbol, untyped]
|
|
252
|
+
|
|
253
|
+
# : (Scores, Node, Node, bool, Node) -> Hash[Symbol, untyped]?
|
|
254
|
+
def self?.explain_at: (Scores, Node, Node, bool, Node) -> Hash[Symbol, untyped]?
|
|
255
|
+
|
|
256
|
+
# Where `expected` first parts from `actual`, or nil when it fits. The
|
|
257
|
+
# walk starts at the actual node the expected tree fits best, the
|
|
258
|
+
# earliest of equals, and follows the docstring's order from there.
|
|
259
|
+
# : (Node, Node) -> Hash[Symbol, untyped]?
|
|
260
|
+
def self?.misfit: (Node, Node) -> Hash[Symbol, untyped]?
|
|
261
|
+
|
|
262
|
+
# : (String) -> String
|
|
263
|
+
def self?.source_text: (String) -> String
|
|
264
|
+
|
|
265
|
+
# : (Node) -> String
|
|
266
|
+
def self?.actual_named: (Node) -> String
|
|
267
|
+
|
|
268
|
+
# : (Node) -> String
|
|
269
|
+
def self?.expected_named: (Node) -> String
|
|
270
|
+
|
|
271
|
+
# What keeps an actual node of the expected line's role and name from
|
|
272
|
+
# fitting it: the first state or property it prints otherwise, or nil
|
|
273
|
+
# when the two lines already show it.
|
|
274
|
+
# : (Node, Node) -> String?
|
|
275
|
+
def self?.line_difference: (Node, Node) -> String?
|
|
276
|
+
|
|
277
|
+
# : (Node) -> String
|
|
278
|
+
def self?.role_words: (Node) -> String
|
|
279
|
+
|
|
280
|
+
# : (Node) -> Integer
|
|
281
|
+
def self?.last_line: (Node) -> Integer
|
|
282
|
+
|
|
283
|
+
# A misfit as one line: the expected node by its docstring line,
|
|
284
|
+
# where it was looked for, and the nearest actual node by its
|
|
285
|
+
# snapshot line.
|
|
286
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
287
|
+
def self?.misfit_text: (Hash[Symbol, untyped]) -> String
|
|
288
|
+
|
|
289
|
+
# Why an expected text is no tree a claim can be judged on, as
|
|
290
|
+
# [:unreadable, line] or [:names_nothing]: either breaks the claim on
|
|
291
|
+
# every page.
|
|
292
|
+
# : ([Symbol, String] | [Symbol]) -> String
|
|
293
|
+
def self?.problem_reason: ([ Symbol, String ] | [ Symbol ]) -> String
|
|
294
|
+
|
|
295
|
+
# : (String) -> (Node | [Symbol, String] | [Symbol])
|
|
296
|
+
def self?.expected_tree: (String) -> (Node | [ Symbol, String ] | [ Symbol ])
|
|
297
|
+
|
|
298
|
+
# Why an expected text breaks a claim on every page, or nil: what the
|
|
299
|
+
# check reports from the line alone, before a run.
|
|
300
|
+
# : (String) -> ([Symbol, String] | [Symbol])?
|
|
301
|
+
def self?.expected_problem: (String) -> ([ Symbol, String ] | [ Symbol ])?
|
|
302
|
+
|
|
303
|
+
# Whether a claim's actual snapshot fits its expected one, from the
|
|
304
|
+
# two texts the record keeps: { fits: }, { broken: }, or { unjudged: }.
|
|
305
|
+
# An expected text that is no tree, or names nothing, breaks the
|
|
306
|
+
# claim, since the line states it. An actual text that does not read
|
|
307
|
+
# leaves the claim unjudged: the browser printed something this
|
|
308
|
+
# reader does not know, which says nothing about the page.
|
|
309
|
+
# : (String, String) -> Hash[Symbol, untyped]
|
|
310
|
+
def self?.judge: (String, String) -> Hash[Symbol, untyped]
|
|
311
|
+
|
|
312
|
+
# : (String, String) -> Hash[Symbol, untyped]?
|
|
313
|
+
def self?.misfit_of: (String, String) -> Hash[Symbol, untyped]?
|
|
314
|
+
|
|
315
|
+
# Where a broken claim's two snapshots part, as one line, or nil when
|
|
316
|
+
# they fit or either does not read.
|
|
317
|
+
# : (String, String) -> String?
|
|
318
|
+
def self?.difference: (String, String) -> String?
|
|
319
|
+
|
|
320
|
+
# The actual lines a misfit points at, so a line that cuts a long
|
|
321
|
+
# snapshot shows where the fix goes: from the child the previous
|
|
322
|
+
# expected sibling fit (or the node it was looked for under) to the
|
|
323
|
+
# nearest node, or with no node of its role, through the children at
|
|
324
|
+
# its place; the end of the node with a child missing; or the extra
|
|
325
|
+
# child. At most EXCERPT_LINES of them, kept at the end the named node
|
|
326
|
+
# is on, as { first:, last:, text: }.
|
|
327
|
+
# : (String, String) -> Hash[Symbol, untyped]?
|
|
328
|
+
def self?.excerpt: (String, String) -> Hash[Symbol, untyped]?
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/aria_tree.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The values an ARIA snapshot reads as (lib/nukadoko/aria_snapshot.rb):
|
|
4
|
+
# the YAML items of its text, the nodes of the tree nukadoko took and of
|
|
5
|
+
# the tree a docstring states, and the scores the explanation of a misfit
|
|
6
|
+
# aligns them with. Nothing here reads a text or judges a fit; the classes
|
|
7
|
+
# sit apart from that module so its functions stay module functions of it
|
|
8
|
+
# alone.
|
|
9
|
+
module Nukadoko
|
|
10
|
+
module Engine
|
|
11
|
+
module AriaSnapshot
|
|
12
|
+
# One scalar of an item: its text after YAML unquoted it, and whether
|
|
13
|
+
# it was written plain, which is when YAML may read it as a number, a
|
|
14
|
+
# boolean, or null.
|
|
15
|
+
class Scalar < Data
|
|
16
|
+
attr_reader text(): String
|
|
17
|
+
|
|
18
|
+
attr_reader plain(): bool
|
|
19
|
+
|
|
20
|
+
def self.new: (String text, bool plain) -> instance
|
|
21
|
+
| (text: String, plain: bool) -> instance
|
|
22
|
+
|
|
23
|
+
def self.members: () -> [ :text, :plain ]
|
|
24
|
+
|
|
25
|
+
def members: () -> [ :text, :plain ]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# One item of the list: a key alone, a key and its text, or a key and
|
|
29
|
+
# its children. `source` is the item as written, after `- ` and before
|
|
30
|
+
# any comment, for a message.
|
|
31
|
+
class Item < Data
|
|
32
|
+
attr_reader line(): Integer
|
|
33
|
+
|
|
34
|
+
attr_reader source(): String
|
|
35
|
+
|
|
36
|
+
attr_reader key(): Scalar
|
|
37
|
+
|
|
38
|
+
attr_reader value(): Scalar?
|
|
39
|
+
|
|
40
|
+
attr_reader children(): Array[Item]?
|
|
41
|
+
|
|
42
|
+
def self.new: (Integer line, String source, Scalar key, Scalar? value, Array[Item]? children) -> instance
|
|
43
|
+
| (line: Integer, source: String, key: Scalar, value: Scalar?, children: Array[Item]?) -> instance
|
|
44
|
+
|
|
45
|
+
def self.members: () -> [ :line, :source, :key, :value, :children ]
|
|
46
|
+
|
|
47
|
+
def members: () -> [ :line, :source, :key, :value, :children ]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# A line of the text that holds an item: its number from 1, the
|
|
51
|
+
# column its content starts at, and the content.
|
|
52
|
+
class Line < Data
|
|
53
|
+
attr_reader number(): Integer
|
|
54
|
+
|
|
55
|
+
attr_reader indent(): Integer
|
|
56
|
+
|
|
57
|
+
attr_reader content(): String
|
|
58
|
+
|
|
59
|
+
def self.new: (Integer number, Integer indent, String content) -> instance
|
|
60
|
+
| (number: Integer, indent: Integer, content: String) -> instance
|
|
61
|
+
|
|
62
|
+
def self.members: () -> [ :number, :indent, :content ]
|
|
63
|
+
|
|
64
|
+
def members: () -> [ :number, :indent, :content ]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# A text as a docstring states it, and with its white space folded
|
|
68
|
+
# the way a page's text is: either one fits.
|
|
69
|
+
class ExpectedText < Data
|
|
70
|
+
attr_reader raw(): String
|
|
71
|
+
|
|
72
|
+
attr_reader normalized(): String
|
|
73
|
+
|
|
74
|
+
def self.new: (String raw, String normalized) -> instance
|
|
75
|
+
| (raw: String, normalized: String) -> instance
|
|
76
|
+
|
|
77
|
+
def self.members: () -> [ :raw, :normalized ]
|
|
78
|
+
|
|
79
|
+
def members: () -> [ :raw, :normalized ]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Why a text is no ARIA snapshot, with the line it found that on.
|
|
83
|
+
class Problem < StandardError
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# One node of the snapshot nukadoko took, or one a docstring names.
|
|
87
|
+
# A text node holds `text`; a role node holds the rest. The top of a
|
|
88
|
+
# tree is a node of role `fragment` that holds the list.
|
|
89
|
+
class Node
|
|
90
|
+
attr_reader kind: :role | :text
|
|
91
|
+
|
|
92
|
+
attr_reader role: String
|
|
93
|
+
|
|
94
|
+
attr_reader name: String
|
|
95
|
+
|
|
96
|
+
attr_reader states: Hash[String, untyped]
|
|
97
|
+
|
|
98
|
+
attr_reader props: Hash[String, untyped]
|
|
99
|
+
|
|
100
|
+
attr_reader children: Array[Node]
|
|
101
|
+
|
|
102
|
+
attr_accessor children_mode: String?
|
|
103
|
+
|
|
104
|
+
attr_reader text: untyped
|
|
105
|
+
|
|
106
|
+
attr_reader line: Integer
|
|
107
|
+
|
|
108
|
+
attr_reader source: String
|
|
109
|
+
|
|
110
|
+
# : (kind: :role | :text, line: Integer, source: String, ?role: String, ?name: String, ?states: Hash[String, untyped], ?props: Hash[String, untyped], ?children: Array[Node], ?children_mode: String?, ?text: untyped) -> void
|
|
111
|
+
def initialize: (kind: :role | :text, line: Integer, source: String, ?role: String, ?name: String, ?states: Hash[String, untyped], ?props: Hash[String, untyped], ?children: Array[Node], ?children_mode: String?, ?text: untyped) -> void
|
|
112
|
+
|
|
113
|
+
# : () -> bool
|
|
114
|
+
def text?: () -> bool
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# How many nodes of an expected tree fit under an actual node, for
|
|
118
|
+
# each pairing, kept so the alignment counts each pair once.
|
|
119
|
+
class Scores
|
|
120
|
+
# : () -> void
|
|
121
|
+
def initialize: () -> void
|
|
122
|
+
|
|
123
|
+
# The nodes of `expected`'s tree that fit under `actual`, `expected`
|
|
124
|
+
# itself included (a fragment counts for none): 0 when `actual` is
|
|
125
|
+
# not the node `expected` names.
|
|
126
|
+
# : (Node, Node, bool) -> Integer
|
|
127
|
+
def of: (Node, Node, bool) -> Integer
|
|
128
|
+
|
|
129
|
+
# The in-order pairing of expected children with actual children
|
|
130
|
+
# that fits the most expected nodes; of equals, the one that pairs
|
|
131
|
+
# each expected child with the earliest actual child it can.
|
|
132
|
+
# : (Array[Node], Array[Node]) -> [Integer, Hash[Integer, Integer]]
|
|
133
|
+
def aligned: (Array[Node], Array[Node]) -> [ Integer, Hash[Integer, Integer] ]
|
|
134
|
+
|
|
135
|
+
private
|
|
136
|
+
|
|
137
|
+
# : (Node, Node, bool) -> Integer
|
|
138
|
+
def compute: (Node, Node, bool) -> Integer
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/base.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# `nuka run --base <ref>`: what changed since the ref, and the trees the
|
|
4
|
+
# rows need to be judged against it. Two trees go in the run's own
|
|
5
|
+
# directory, under trees/:
|
|
6
|
+
#
|
|
7
|
+
# - base: the ref's code with head's features/ and config, so a new or
|
|
8
|
+
# changed criterion runs where its behaviour should be absent. The ref's
|
|
9
|
+
# program file starts it, or head's when the ref has none.
|
|
10
|
+
# - old: head's working tree with the ref's features/ and config, so an
|
|
11
|
+
# unchanged criterion over a changed mapping runs under the steps it was
|
|
12
|
+
# approved with.
|
|
13
|
+
#
|
|
14
|
+
# The mapping is every file under features/ but a .feature file, the config
|
|
15
|
+
# file's bytes, and the program file's conditions and defaultEnvironments,
|
|
16
|
+
# which decide where a criterion is required. Every git command runs with
|
|
17
|
+
# hooks off, since a checkout's hook is the project's code and not the
|
|
18
|
+
# run's. Both trees are removed when the run ends.
|
|
19
|
+
module Nukadoko
|
|
20
|
+
module Engine
|
|
21
|
+
class Base
|
|
22
|
+
NO_HOOKS: untyped
|
|
23
|
+
|
|
24
|
+
FEATURES: ::String
|
|
25
|
+
|
|
26
|
+
CONFIG: ::String
|
|
27
|
+
|
|
28
|
+
PROGRAM: ::String
|
|
29
|
+
|
|
30
|
+
STATE: ::String
|
|
31
|
+
|
|
32
|
+
attr_reader ref: String
|
|
33
|
+
|
|
34
|
+
attr_reader commit: String
|
|
35
|
+
|
|
36
|
+
attr_reader changes: Hash[untyped, Hash[Symbol, untyped]]
|
|
37
|
+
|
|
38
|
+
attr_reader removed: Array[Criteria::Criterion]
|
|
39
|
+
|
|
40
|
+
attr_reader mapping: Hash[Symbol, untyped]
|
|
41
|
+
|
|
42
|
+
attr_reader base_root: String?
|
|
43
|
+
|
|
44
|
+
attr_reader old_root: String?
|
|
45
|
+
|
|
46
|
+
attr_reader old_environments: Array[Environment]?
|
|
47
|
+
|
|
48
|
+
attr_reader program_from_head: bool?
|
|
49
|
+
|
|
50
|
+
# The commit `ref` names, or a Refusal with the TypeScript engine's
|
|
51
|
+
# code: outside git, a shallow clone that lacks it, or no such commit.
|
|
52
|
+
# : (String, String) -> String
|
|
53
|
+
def self.resolve: (String, String) -> String
|
|
54
|
+
|
|
55
|
+
# : (String, *String, ?strip: bool) -> [String, bool]
|
|
56
|
+
def self.git: (String, *String, ?strip: bool) -> [ String, bool ]
|
|
57
|
+
|
|
58
|
+
# `selected` is each selected scenario's [feature, line]; `targets` the
|
|
59
|
+
# run's targets without a line, or nil for the features directory.
|
|
60
|
+
# : (project: String, ref: String, commit: String, run_dir: String, selected: Array[[String, Integer]], targets: Array[String]?, envs: Array[String], head_program: Hash[Symbol, untyped]?) -> void
|
|
61
|
+
def initialize: (project: String, ref: String, commit: String, run_dir: String, selected: Array[[ String, Integer ]], targets: Array[String]?, envs: Array[String], head_program: Hash[Symbol, untyped]?) -> void
|
|
62
|
+
|
|
63
|
+
# : () -> void
|
|
64
|
+
def cleanup: () -> void
|
|
65
|
+
|
|
66
|
+
# The ref's place of an unchanged head row, and the head row a place
|
|
67
|
+
# at the ref is.
|
|
68
|
+
# : ([String, Integer]) -> Hash[Symbol, untyped]?
|
|
69
|
+
def at: ([ String, Integer ]) -> Hash[Symbol, untyped]?
|
|
70
|
+
|
|
71
|
+
# : (String, Integer) -> [String, Integer]?
|
|
72
|
+
def row_of: (String, Integer) -> [ String, Integer ]?
|
|
73
|
+
|
|
74
|
+
# : () -> Hash[Symbol, untyped]
|
|
75
|
+
def mapping_changes: () -> Hash[Symbol, untyped]
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
# : (String) -> String
|
|
80
|
+
def in_repo: (String) -> String
|
|
81
|
+
|
|
82
|
+
# : (Array[[String, Integer]], Array[String]?, Array[String], Hash[Symbol, untyped]?) -> void
|
|
83
|
+
def prepare: (Array[[ String, Integer ]], Array[String]?, Array[String], Hash[Symbol, untyped]?) -> void
|
|
84
|
+
|
|
85
|
+
# The environments the old world runs in, with the conditions the ref's
|
|
86
|
+
# program file gives each; nil when the ref has no program file, so
|
|
87
|
+
# head's environments are the old world's too.
|
|
88
|
+
# : (Hash[Symbol, untyped]?, Array[String]) -> Array[Environment]?
|
|
89
|
+
def old_environments_of: (Hash[Symbol, untyped]?, Array[String]) -> Array[Environment]?
|
|
90
|
+
|
|
91
|
+
# : (String, Array[String]) -> Array[String]
|
|
92
|
+
def feature_files: (String, Array[String]) -> Array[String]
|
|
93
|
+
|
|
94
|
+
# Head's working tree as a copy holds it: tracked files and untracked
|
|
95
|
+
# ones git does not ignore, on disk, outside the state directory.
|
|
96
|
+
# : () -> Array[String]
|
|
97
|
+
def working_tree_files: () -> Array[String]
|
|
98
|
+
|
|
99
|
+
# : (String, String) -> bool
|
|
100
|
+
def within?: (String, String) -> bool
|
|
101
|
+
|
|
102
|
+
# : (String) -> bool
|
|
103
|
+
def mapping?: (String) -> bool
|
|
104
|
+
|
|
105
|
+
# : (String) -> String
|
|
106
|
+
def hash_of: (String) -> String
|
|
107
|
+
|
|
108
|
+
# : (Array[String], String) -> Hash[String, String]
|
|
109
|
+
def mapping_files: (Array[String], String) -> Hash[String, String]
|
|
110
|
+
|
|
111
|
+
# The ref's program file read in a process of its own, since loading
|
|
112
|
+
# it here would replace head's: its conditions and defaultEnvironments.
|
|
113
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
114
|
+
def read_program: (String) -> Hash[Symbol, untyped]
|
|
115
|
+
|
|
116
|
+
# : (Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
117
|
+
def program_mapping: (Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
118
|
+
|
|
119
|
+
# : (Array[String], Array[String], String, Hash[Symbol, untyped]?, Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
120
|
+
def compare_mapping: (Array[String], Array[String], String, Hash[Symbol, untyped]?, Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
121
|
+
|
|
122
|
+
# : (String, String) -> void
|
|
123
|
+
def copy: (String, String) -> void
|
|
124
|
+
|
|
125
|
+
# The ref's checkout loses the ref's mapping and gains head's; the
|
|
126
|
+
# ref's program file stays, or head's comes in when the ref has none.
|
|
127
|
+
# : (Array[String], Array[String]) -> void
|
|
128
|
+
def overlay_base_tree: (Array[String], Array[String]) -> void
|
|
129
|
+
|
|
130
|
+
# Head's working tree with the ref's mapping in place of its own,
|
|
131
|
+
# written before the base checkout is overlaid.
|
|
132
|
+
# : (Array[String], Array[String]) -> void
|
|
133
|
+
def write_old_tree: (Array[String], Array[String]) -> void
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|