flay-rs 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bb4807fe3c20fcd8e870093a18b4c11fa8f92903b9ba15d448f7940fc577f764
4
+ data.tar.gz: 388b11675f877387f360131c584046db449776ef7c918d19f7843706d2bb2172
5
+ SHA512:
6
+ metadata.gz: b3fddee134278af0bfb9af063a1f93558c33b8331efdcbfdc6b0d8809c170a844b01c28dd79c1c14081c492e01ed12a1f5f5ae7a93ced506be728413223df52c
7
+ data.tar.gz: 2249885be278e366f9c93ba8bd1d97fc37ae7b54e777339947e3d371f3048f3f0e7d39f20d5f71725c97539f771e1e906d0a68398ba5fce6ffd4dacb5217430c
data/Cargo.lock ADDED
@@ -0,0 +1,495 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.72.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "proc-macro2",
25
+ "quote",
26
+ "regex",
27
+ "rustc-hash",
28
+ "shlex 1.3.0",
29
+ "syn 2.0.119",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "bitflags"
34
+ version = "2.13.2"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
37
+
38
+ [[package]]
39
+ name = "cc"
40
+ version = "1.13.0"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "53b4e5299ae8fd0d9e848f3efafd5b4feed729b8c731df9d62375cb1efdc3f4e"
43
+ dependencies = [
44
+ "find-msvc-tools",
45
+ "shlex 2.0.1",
46
+ ]
47
+
48
+ [[package]]
49
+ name = "cexpr"
50
+ version = "0.6.0"
51
+ source = "registry+https://github.com/rust-lang/crates.io-index"
52
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
53
+ dependencies = [
54
+ "nom",
55
+ ]
56
+
57
+ [[package]]
58
+ name = "cfg-if"
59
+ version = "1.0.5"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
62
+
63
+ [[package]]
64
+ name = "clang-sys"
65
+ version = "1.9.1"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
68
+ dependencies = [
69
+ "glob",
70
+ "libc",
71
+ "libloading",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "crc32fast"
76
+ version = "1.5.2"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
79
+ dependencies = [
80
+ "cfg-if",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "crossbeam-deque"
85
+ version = "0.8.8"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
88
+ dependencies = [
89
+ "crossbeam-epoch",
90
+ "crossbeam-utils",
91
+ ]
92
+
93
+ [[package]]
94
+ name = "crossbeam-epoch"
95
+ version = "0.9.21"
96
+ source = "registry+https://github.com/rust-lang/crates.io-index"
97
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
98
+ dependencies = [
99
+ "crossbeam-utils",
100
+ ]
101
+
102
+ [[package]]
103
+ name = "crossbeam-utils"
104
+ version = "0.8.23"
105
+ source = "registry+https://github.com/rust-lang/crates.io-index"
106
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
107
+
108
+ [[package]]
109
+ name = "either"
110
+ version = "1.19.0"
111
+ source = "registry+https://github.com/rust-lang/crates.io-index"
112
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
113
+
114
+ [[package]]
115
+ name = "equivalent"
116
+ version = "1.0.3"
117
+ source = "registry+https://github.com/rust-lang/crates.io-index"
118
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
119
+
120
+ [[package]]
121
+ name = "find-msvc-tools"
122
+ version = "0.1.17"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "f35b0b9b788e7109a8eb0607f5c8a13495edee3ef8e246f60f0664a7cd25b277"
125
+
126
+ [[package]]
127
+ name = "flay-cli"
128
+ version = "0.1.0"
129
+ dependencies = [
130
+ "flay-core",
131
+ "rayon",
132
+ "serde_json",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "flay-core"
137
+ version = "0.1.0"
138
+ dependencies = [
139
+ "crc32fast",
140
+ "indexmap",
141
+ "rayon",
142
+ "ruby-prism",
143
+ "ruby-prism-sys",
144
+ ]
145
+
146
+ [[package]]
147
+ name = "flay_rs"
148
+ version = "0.1.0"
149
+ dependencies = [
150
+ "flay-core",
151
+ "magnus",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "foldhash"
156
+ version = "0.2.0"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
159
+
160
+ [[package]]
161
+ name = "glob"
162
+ version = "0.3.4"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
165
+
166
+ [[package]]
167
+ name = "hashbrown"
168
+ version = "0.17.2"
169
+ source = "registry+https://github.com/rust-lang/crates.io-index"
170
+ checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
171
+
172
+ [[package]]
173
+ name = "indexmap"
174
+ version = "2.14.2"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+ checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
177
+ dependencies = [
178
+ "equivalent",
179
+ "hashbrown",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "itertools"
184
+ version = "0.13.0"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
187
+ dependencies = [
188
+ "either",
189
+ ]
190
+
191
+ [[package]]
192
+ name = "itoa"
193
+ version = "1.0.19"
194
+ source = "registry+https://github.com/rust-lang/crates.io-index"
195
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
196
+
197
+ [[package]]
198
+ name = "lazy_static"
199
+ version = "1.5.1"
200
+ source = "registry+https://github.com/rust-lang/crates.io-index"
201
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
202
+
203
+ [[package]]
204
+ name = "libc"
205
+ version = "0.2.191"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
208
+
209
+ [[package]]
210
+ name = "libloading"
211
+ version = "0.8.9"
212
+ source = "registry+https://github.com/rust-lang/crates.io-index"
213
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
214
+ dependencies = [
215
+ "cfg-if",
216
+ "windows-link",
217
+ ]
218
+
219
+ [[package]]
220
+ name = "magnus"
221
+ version = "0.9.4"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+ checksum = "3c5f2dd2017d172e2fde9969a35f10f1374a4dd79b37a17f1847f83201883de7"
224
+ dependencies = [
225
+ "magnus-macros",
226
+ "rb-sys",
227
+ "rb-sys-env",
228
+ "seq-macro",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "magnus-macros"
233
+ version = "0.9.1"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
236
+ dependencies = [
237
+ "proc-macro2",
238
+ "quote",
239
+ "syn 2.0.119",
240
+ ]
241
+
242
+ [[package]]
243
+ name = "memchr"
244
+ version = "2.8.3"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
247
+
248
+ [[package]]
249
+ name = "minimal-lexical"
250
+ version = "0.2.1"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
253
+
254
+ [[package]]
255
+ name = "nom"
256
+ version = "7.1.3"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
259
+ dependencies = [
260
+ "memchr",
261
+ "minimal-lexical",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "proc-macro2"
266
+ version = "1.0.107"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
269
+ dependencies = [
270
+ "unicode-ident",
271
+ ]
272
+
273
+ [[package]]
274
+ name = "quote"
275
+ version = "1.0.47"
276
+ source = "registry+https://github.com/rust-lang/crates.io-index"
277
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
278
+ dependencies = [
279
+ "proc-macro2",
280
+ ]
281
+
282
+ [[package]]
283
+ name = "rayon"
284
+ version = "1.12.0"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
287
+ dependencies = [
288
+ "either",
289
+ "rayon-core",
290
+ ]
291
+
292
+ [[package]]
293
+ name = "rayon-core"
294
+ version = "1.13.0"
295
+ source = "registry+https://github.com/rust-lang/crates.io-index"
296
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
297
+ dependencies = [
298
+ "crossbeam-deque",
299
+ "crossbeam-utils",
300
+ ]
301
+
302
+ [[package]]
303
+ name = "rb-sys"
304
+ version = "0.9.130"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
307
+ dependencies = [
308
+ "rb-sys-build",
309
+ ]
310
+
311
+ [[package]]
312
+ name = "rb-sys-build"
313
+ version = "0.9.130"
314
+ source = "registry+https://github.com/rust-lang/crates.io-index"
315
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
316
+ dependencies = [
317
+ "bindgen",
318
+ "lazy_static",
319
+ "proc-macro2",
320
+ "quote",
321
+ "regex",
322
+ "shell-words",
323
+ "syn 2.0.119",
324
+ ]
325
+
326
+ [[package]]
327
+ name = "rb-sys-env"
328
+ version = "0.2.3"
329
+ source = "registry+https://github.com/rust-lang/crates.io-index"
330
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
331
+
332
+ [[package]]
333
+ name = "regex"
334
+ version = "1.13.2"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
337
+ dependencies = [
338
+ "aho-corasick",
339
+ "memchr",
340
+ "regex-automata",
341
+ "regex-syntax",
342
+ ]
343
+
344
+ [[package]]
345
+ name = "regex-automata"
346
+ version = "0.4.19"
347
+ source = "registry+https://github.com/rust-lang/crates.io-index"
348
+ checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
349
+ dependencies = [
350
+ "aho-corasick",
351
+ "memchr",
352
+ "regex-syntax",
353
+ ]
354
+
355
+ [[package]]
356
+ name = "regex-syntax"
357
+ version = "0.8.12"
358
+ source = "registry+https://github.com/rust-lang/crates.io-index"
359
+ checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
360
+
361
+ [[package]]
362
+ name = "ruby-prism"
363
+ version = "2.1.0"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "ef9dd23fe10d6335d390c9fd23cf7dac83f594be5676ad28de58d6f2bac65f4c"
366
+ dependencies = [
367
+ "ruby-prism-sys",
368
+ "serde",
369
+ "serde_json",
370
+ ]
371
+
372
+ [[package]]
373
+ name = "ruby-prism-sys"
374
+ version = "2.1.0"
375
+ source = "registry+https://github.com/rust-lang/crates.io-index"
376
+ checksum = "f3e6b1801eb164c6b2c6c6cd42e55bf61d73f973719f675370769ce0295ba7f1"
377
+ dependencies = [
378
+ "cc",
379
+ "shlex 2.0.1",
380
+ ]
381
+
382
+ [[package]]
383
+ name = "rustc-hash"
384
+ version = "2.1.4"
385
+ source = "registry+https://github.com/rust-lang/crates.io-index"
386
+ checksum = "ca420ddf5554e546a707e0ecb8bd311d505ee00b40982a7064b8bdc48aa59336"
387
+
388
+ [[package]]
389
+ name = "seq-macro"
390
+ version = "0.3.6"
391
+ source = "registry+https://github.com/rust-lang/crates.io-index"
392
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
393
+
394
+ [[package]]
395
+ name = "serde"
396
+ version = "1.0.229"
397
+ source = "registry+https://github.com/rust-lang/crates.io-index"
398
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
399
+ dependencies = [
400
+ "serde_core",
401
+ "serde_derive",
402
+ ]
403
+
404
+ [[package]]
405
+ name = "serde_core"
406
+ version = "1.0.229"
407
+ source = "registry+https://github.com/rust-lang/crates.io-index"
408
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
409
+ dependencies = [
410
+ "serde_derive",
411
+ ]
412
+
413
+ [[package]]
414
+ name = "serde_derive"
415
+ version = "1.0.229"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
418
+ dependencies = [
419
+ "proc-macro2",
420
+ "quote",
421
+ "syn 3.0.10",
422
+ ]
423
+
424
+ [[package]]
425
+ name = "serde_json"
426
+ version = "1.0.154"
427
+ source = "registry+https://github.com/rust-lang/crates.io-index"
428
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
429
+ dependencies = [
430
+ "foldhash",
431
+ "indexmap",
432
+ "itoa",
433
+ "memchr",
434
+ "serde",
435
+ "serde_core",
436
+ "zmij",
437
+ ]
438
+
439
+ [[package]]
440
+ name = "shell-words"
441
+ version = "1.1.1"
442
+ source = "registry+https://github.com/rust-lang/crates.io-index"
443
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
444
+
445
+ [[package]]
446
+ name = "shlex"
447
+ version = "1.3.0"
448
+ source = "registry+https://github.com/rust-lang/crates.io-index"
449
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
450
+
451
+ [[package]]
452
+ name = "shlex"
453
+ version = "2.0.1"
454
+ source = "registry+https://github.com/rust-lang/crates.io-index"
455
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
456
+
457
+ [[package]]
458
+ name = "syn"
459
+ version = "2.0.119"
460
+ source = "registry+https://github.com/rust-lang/crates.io-index"
461
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
462
+ dependencies = [
463
+ "proc-macro2",
464
+ "quote",
465
+ "unicode-ident",
466
+ ]
467
+
468
+ [[package]]
469
+ name = "syn"
470
+ version = "3.0.10"
471
+ source = "registry+https://github.com/rust-lang/crates.io-index"
472
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
473
+ dependencies = [
474
+ "proc-macro2",
475
+ "quote",
476
+ "unicode-ident",
477
+ ]
478
+
479
+ [[package]]
480
+ name = "unicode-ident"
481
+ version = "1.0.27"
482
+ source = "registry+https://github.com/rust-lang/crates.io-index"
483
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
484
+
485
+ [[package]]
486
+ name = "windows-link"
487
+ version = "0.2.1"
488
+ source = "registry+https://github.com/rust-lang/crates.io-index"
489
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
490
+
491
+ [[package]]
492
+ name = "zmij"
493
+ version = "1.0.23"
494
+ source = "registry+https://github.com/rust-lang/crates.io-index"
495
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
data/Cargo.toml ADDED
@@ -0,0 +1,23 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = ["crates/flay-core", "crates/flay-cli", "ext/flay_rs"]
4
+
5
+ [workspace.package]
6
+ version = "0.1.0"
7
+ edition = "2021"
8
+ rust-version = "1.85" # magnus 0.9 requires 1.85
9
+ license = "MIT"
10
+ authors = ["Eric Burns"]
11
+ homepage = "https://gloom.fm"
12
+ repository = "https://github.com/gloom-fm/flay-rs"
13
+
14
+ [workspace.dependencies]
15
+ ruby-prism = "=2.1.0"
16
+ ruby-prism-sys = "=2.1.0"
17
+ indexmap = "2"
18
+ rayon = "1"
19
+ crc32fast = "1"
20
+
21
+ [profile.release]
22
+ lto = true
23
+ codegen-units = 1
data/DIVERGENCES.md ADDED
@@ -0,0 +1,23 @@
1
+ # Deliberate differences from Flay 2.14.5
2
+
3
+ With any options, `hashes`, `masses`, `identical`, `total`, the report
4
+ items, summary and report text have no known differences. The items below are
5
+ outside the parity contract.
6
+
7
+ | Difference | Flay 2.14.5 | FlayRs |
8
+ | --- | --- | --- |
9
+ | `Flay.load_plugins` | Loads every installed `flay_*.rb` plugin and returns their names | `FlayRs::Flay.load_plugins` turns on Flay's own `flay_erb` plugin only (ported to Rust) and returns `["erb"]` |
10
+ | ERB files under a locale other than UTF-8 | `process_erb` reads the template with `File.read`, in `Encoding.default_external` | Reads the template as UTF-8 |
11
+ | Objects in `option[:filters]` | Any object with `satisfy?`; an object without it raises `NoMethodError` when the first sexp is checked | Only the `Sexp::Matcher` classes (not subclasses), holding modules and core values (nil, true, false, Integer, Float, Rational, Complex, Ranges of Integers, Symbol, String, Regexp). Any other object, a plain `Sexp` or `Array` included, raises `ArgumentError` when `process` starts, even where Flay would never call it |
12
+ | A `Sexp::Pattern` filter whose regexp uses look-behind, back-references, `\p{...}`, POSIX brackets, nested or intersected character classes, `\G`, `\K`, `\R`, `\X`, `\c`, absent operators, conditionals, the `a`, `d` or `u` options, or a multibyte encoding other than UTF-8 | Matched by Onigmo | `process` raises `NotImplementedError` when it starts |
13
+ | `diff` report: comments above `class`, `module` and `def` | Kept on the sexps from parsing | Read again from the file when the report is written; a file changed in between gives that file's new comments, a file removed in between raises `Errno::ENOENT` |
14
+ | `diff` report without the ruby2ruby gem | Prints `ruby2ruby is required for diff` for each node | Prints the code: Ruby2Ruby 2.6.2 is ported to Rust |
15
+ | `parser: RubyParser` (`--legacy`) | Parses with the ruby_parser gem | Always parses as the default parser, `Prism::Translation::RubyParser`, does |
16
+ | `timeout` option | Parsing is wrapped in `Timeout.timeout(timeout)` | Accepted and ignored |
17
+ | Values in `Flay#hashes` | `Sexp` objects | `FlayRs::Node` structs with `sexp_type`/`first`, `file`, `line`, `mass`, `structural_hash` and `modified?`; no children |
18
+ | `total=`, `masses=`, `identical=` | Writers exist | Not defined; `mass_threshold=` is |
19
+ | A regexp literal that Prism accepts but Onigmo rejects, e.g. `/[b-a]/`, `/a{2,1}/`, `/(?<a>x)\k<b>/` | `Regexp.new` raises `RegexpError`; Flay skips the file | The file is processed. Ruby itself refuses to run such a file. |
20
+ | Invalid multibyte characters in a regexp in a source encoding other than UTF-8 (for example Shift_JIS) | `Regexp.new` raises; Flay skips the file | Not checked; the file is processed |
21
+ | `Rational == Float` inside sexps compared for `identical`, with a numerator or denominator above 2**53 | Ruby's exact `Rational#to_f` | `numerator.to_f / denominator.to_f` |
22
+ | Messages of exceptions other than syntax errors in the warnings for skipped files | Ruby's wording | Same exception class; the wording may differ |
23
+ | Ruby versions | Any | Parity verified under Ruby 3.3, 3.4 and 4.0 |
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) Eric Burns, gloom.fm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # flay-rs
2
+
3
+ > [!WARNING]
4
+ > This is a vibe coded, pseudo port of the [Flay](https://github.com/seattlerb/flay) Ruby gem. Use at your own risk. When things go right, credit goes to the authors this code is based on. When things go wrong, blame goes to you for installing it.
5
+
6
+ ## Credit
7
+
8
+ The code in `flay-rs` was generated from Ryan Davis's work on [Flay](https://github.com/seattlerb/flay). All credit for the design of the analysis this is based on goes to him.
9
+
10
+ See `THIRD_PARTY_NOTICES.md`, for all notices.
11
+
12
+ ## Layout
13
+
14
+ ```
15
+ crates/flay-core/ engine: Prism tree -> ruby_parser sexp tree -> Flay state
16
+ crates/flay-cli/ flay-rs binary: JSON output, files parsed in parallel
17
+ ext/flay_rs/ Ruby binding (Magnus, rb_sys): FlayRs::Flay, the ::Flay API RubyCritic uses
18
+ lib/flay_rs.rb loads the extension
19
+ parity/ oracle runner, comparer, fixtures, quirks
20
+ test/ Ruby tests: FlayRs::Flay against ::Flay on every fixture
21
+ ```
22
+
23
+ ## Installing
24
+
25
+ The Ruby gem builds the extension with Cargo, so you will need Rust 1.85 or later.
26
+
27
+ As a Ruby gem:
28
+
29
+ ```sh
30
+ gem install flay-rs
31
+ ```
32
+
33
+ As a Rust library or the `flay-rs` binary:
34
+
35
+ ```sh
36
+ cargo add flay-core
37
+ cargo install flay-cli
38
+ ```
39
+
40
+ ## Building
41
+
42
+ Rust 1.85 or later (magnus 0.9 requires it) and Ruby 3.3 or later.
43
+
44
+ ```sh
45
+ bundle install
46
+ bundle exec rake compile # builds lib/flay_rs/flay_rs.so
47
+ bundle exec rake test # compares with the real flay gem
48
+ cargo test && cargo clippy --all-targets
49
+ cargo build --release -p flay-cli
50
+ ```
51
+
52
+ If `bindgen` reports `'stdarg.h' file not found`, `libclang` cannot find its own headers. You'll need to point it at them, for example (use the path of your installed clang):
53
+
54
+ ```bash
55
+ export BINDGEN_EXTRA_CLANG_ARGS="-I/usr/lib/clang/22/include"
56
+ ```
57
+
58
+ ## Ruby API
59
+
60
+ ```ruby
61
+ require "flay_rs"
62
+
63
+ FlayRs::Flay.load_plugins # ["erb"]: process .erb files, as Flay.run does
64
+ flay = FlayRs::Flay.new(mass: 16) # Flay.default_options, merged: fuzzy:, liberal:, diff:, filters:...
65
+ flay.process(*paths) # parse in parallel, process in order
66
+ items = flay.analyze # prune, identical, masses; sorted items
67
+ flay.hashes # { structural_hash => [FlayRs::Node, ...] }
68
+ flay.masses # { structural_hash => mass }
69
+ flay.identical # { structural_hash => true/false }
70
+ flay.total
71
+ flay.summary # { file => score }
72
+ flay.report # Flay's report text, to $stdout or the IO given
73
+
74
+ FlayRs::Flay::DEFAULT_IGNORE # ".flayignore"
75
+ FlayRs::FLAY_COMPAT # "2.14.5"
76
+ ```
77
+
78
+ `FlayRs::Node` has the fields Flay's results read from a sexp: `sexp_type`
79
+ (also `first`), `file`, `line`, `mass`, `structural_hash` and `modified`
80
+ (also `modified?`, true for the nodes the `fuzzy` option made).
81
+
82
+ ## CLI
83
+
84
+ ```sh
85
+ flay-rs [--mass=N] [--ruby-version=V] [--files-from=LIST] PATHS...
86
+ flay-rs --dump [--ruby-version=V] [--files-from=LIST] PATHS...
87
+ ```
88
+
89
+ `--dump` prints each file's translated tree instead of the analysis.
90
+
91
+ ## Parity harness
92
+
93
+ ```sh
94
+ cd parity && bundle install
95
+ ./run.sh # fixtures (default)
96
+ ./run.sh path/to/code ... # any files or directories
97
+ MASS=4 ./run.sh # another mass threshold
98
+ ```
99
+
100
+ `run.sh` runs both the original Flay gem (`oracle.rb`) and `flay-rs` on the same files, then `compare.rb` diffs every file's translated tree and one analysis of all the files together.
101
+
102
+ On parity:
103
+ - `parity/api_compare.rb` compares `::Flay` and `FlayRs::Flay` through the Ruby API, with any options
104
+ - `parity/run_erb.sh` compares ERB files
105
+ - `parity/ruby2ruby_run.sh` and `parity/matcher_run.sh` compare the Ruby2Ruby and `Sexp::Matcher` ports on their own
106
+ - `parity/QUIRKS.md` lists behavior from Flay we're intentionally matching
107
+ - `DIVERGENCES.md` lists intentional differences
108
+
109
+ ## License
110
+
111
+ MIT (see `LICENSE`). `flay-rs` ports code from Flay and other projects. Their notices are in `THIRD_PARTY_NOTICES.md`.