flog-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: df519d7f5289dcea1b48383bdfa3d7e430154025394ea362f00057e0269bbd70
4
+ data.tar.gz: 24a5f02b3970f3948e349aa188f93c660744fcc583eedaee80ccc664163f9d62
5
+ SHA512:
6
+ metadata.gz: 479821117ba05f790c3c91695a2948b02c9722cfc7ecce0492ca010f419d1e711c74c2d86ce2a71ada1f43c542d01eb7710313c81d7cad3a81828f0f4eeaf0a4
7
+ data.tar.gz: d449b36066f5642a2b2661495f0e4c2655f03f56f6a848c7ca90dfc0d376ec7055622a55109f52baed72ed89cc7a463d8ab8dc442583efcb392b680027e1feec
data/Cargo.lock ADDED
@@ -0,0 +1,486 @@
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 = "crossbeam-deque"
76
+ version = "0.8.8"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
79
+ dependencies = [
80
+ "crossbeam-epoch",
81
+ "crossbeam-utils",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "crossbeam-epoch"
86
+ version = "0.9.21"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
89
+ dependencies = [
90
+ "crossbeam-utils",
91
+ ]
92
+
93
+ [[package]]
94
+ name = "crossbeam-utils"
95
+ version = "0.8.23"
96
+ source = "registry+https://github.com/rust-lang/crates.io-index"
97
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
98
+
99
+ [[package]]
100
+ name = "either"
101
+ version = "1.19.0"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
104
+
105
+ [[package]]
106
+ name = "equivalent"
107
+ version = "1.0.3"
108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
109
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
110
+
111
+ [[package]]
112
+ name = "find-msvc-tools"
113
+ version = "0.1.17"
114
+ source = "registry+https://github.com/rust-lang/crates.io-index"
115
+ checksum = "f35b0b9b788e7109a8eb0607f5c8a13495edee3ef8e246f60f0664a7cd25b277"
116
+
117
+ [[package]]
118
+ name = "flog-cli"
119
+ version = "0.1.0"
120
+ dependencies = [
121
+ "flog-core",
122
+ "indexmap",
123
+ "rayon",
124
+ "serde_json",
125
+ ]
126
+
127
+ [[package]]
128
+ name = "flog-core"
129
+ version = "0.1.0"
130
+ dependencies = [
131
+ "indexmap",
132
+ "ruby-prism",
133
+ "ruby-prism-sys",
134
+ ]
135
+
136
+ [[package]]
137
+ name = "flog_rs"
138
+ version = "0.1.0"
139
+ dependencies = [
140
+ "flog-core",
141
+ "magnus",
142
+ "rayon",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "foldhash"
147
+ version = "0.2.0"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
150
+
151
+ [[package]]
152
+ name = "glob"
153
+ version = "0.3.4"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
156
+
157
+ [[package]]
158
+ name = "hashbrown"
159
+ version = "0.17.2"
160
+ source = "registry+https://github.com/rust-lang/crates.io-index"
161
+ checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
162
+
163
+ [[package]]
164
+ name = "indexmap"
165
+ version = "2.14.2"
166
+ source = "registry+https://github.com/rust-lang/crates.io-index"
167
+ checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
168
+ dependencies = [
169
+ "equivalent",
170
+ "hashbrown",
171
+ ]
172
+
173
+ [[package]]
174
+ name = "itertools"
175
+ version = "0.13.0"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
178
+ dependencies = [
179
+ "either",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "itoa"
184
+ version = "1.0.19"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
187
+
188
+ [[package]]
189
+ name = "lazy_static"
190
+ version = "1.5.1"
191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
192
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
193
+
194
+ [[package]]
195
+ name = "libc"
196
+ version = "0.2.191"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
199
+
200
+ [[package]]
201
+ name = "libloading"
202
+ version = "0.8.9"
203
+ source = "registry+https://github.com/rust-lang/crates.io-index"
204
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
205
+ dependencies = [
206
+ "cfg-if",
207
+ "windows-link",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "magnus"
212
+ version = "0.9.4"
213
+ source = "registry+https://github.com/rust-lang/crates.io-index"
214
+ checksum = "3c5f2dd2017d172e2fde9969a35f10f1374a4dd79b37a17f1847f83201883de7"
215
+ dependencies = [
216
+ "magnus-macros",
217
+ "rb-sys",
218
+ "rb-sys-env",
219
+ "seq-macro",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "magnus-macros"
224
+ version = "0.9.1"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
227
+ dependencies = [
228
+ "proc-macro2",
229
+ "quote",
230
+ "syn 2.0.119",
231
+ ]
232
+
233
+ [[package]]
234
+ name = "memchr"
235
+ version = "2.8.3"
236
+ source = "registry+https://github.com/rust-lang/crates.io-index"
237
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
238
+
239
+ [[package]]
240
+ name = "minimal-lexical"
241
+ version = "0.2.1"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
244
+
245
+ [[package]]
246
+ name = "nom"
247
+ version = "7.1.3"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
250
+ dependencies = [
251
+ "memchr",
252
+ "minimal-lexical",
253
+ ]
254
+
255
+ [[package]]
256
+ name = "proc-macro2"
257
+ version = "1.0.107"
258
+ source = "registry+https://github.com/rust-lang/crates.io-index"
259
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
260
+ dependencies = [
261
+ "unicode-ident",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "quote"
266
+ version = "1.0.47"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
269
+ dependencies = [
270
+ "proc-macro2",
271
+ ]
272
+
273
+ [[package]]
274
+ name = "rayon"
275
+ version = "1.12.0"
276
+ source = "registry+https://github.com/rust-lang/crates.io-index"
277
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
278
+ dependencies = [
279
+ "either",
280
+ "rayon-core",
281
+ ]
282
+
283
+ [[package]]
284
+ name = "rayon-core"
285
+ version = "1.13.0"
286
+ source = "registry+https://github.com/rust-lang/crates.io-index"
287
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
288
+ dependencies = [
289
+ "crossbeam-deque",
290
+ "crossbeam-utils",
291
+ ]
292
+
293
+ [[package]]
294
+ name = "rb-sys"
295
+ version = "0.9.130"
296
+ source = "registry+https://github.com/rust-lang/crates.io-index"
297
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
298
+ dependencies = [
299
+ "rb-sys-build",
300
+ ]
301
+
302
+ [[package]]
303
+ name = "rb-sys-build"
304
+ version = "0.9.130"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
307
+ dependencies = [
308
+ "bindgen",
309
+ "lazy_static",
310
+ "proc-macro2",
311
+ "quote",
312
+ "regex",
313
+ "shell-words",
314
+ "syn 2.0.119",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "rb-sys-env"
319
+ version = "0.2.3"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
322
+
323
+ [[package]]
324
+ name = "regex"
325
+ version = "1.13.2"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
328
+ dependencies = [
329
+ "aho-corasick",
330
+ "memchr",
331
+ "regex-automata",
332
+ "regex-syntax",
333
+ ]
334
+
335
+ [[package]]
336
+ name = "regex-automata"
337
+ version = "0.4.19"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
340
+ dependencies = [
341
+ "aho-corasick",
342
+ "memchr",
343
+ "regex-syntax",
344
+ ]
345
+
346
+ [[package]]
347
+ name = "regex-syntax"
348
+ version = "0.8.12"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
351
+
352
+ [[package]]
353
+ name = "ruby-prism"
354
+ version = "2.1.0"
355
+ source = "registry+https://github.com/rust-lang/crates.io-index"
356
+ checksum = "ef9dd23fe10d6335d390c9fd23cf7dac83f594be5676ad28de58d6f2bac65f4c"
357
+ dependencies = [
358
+ "ruby-prism-sys",
359
+ "serde",
360
+ "serde_json",
361
+ ]
362
+
363
+ [[package]]
364
+ name = "ruby-prism-sys"
365
+ version = "2.1.0"
366
+ source = "registry+https://github.com/rust-lang/crates.io-index"
367
+ checksum = "f3e6b1801eb164c6b2c6c6cd42e55bf61d73f973719f675370769ce0295ba7f1"
368
+ dependencies = [
369
+ "cc",
370
+ "shlex 2.0.1",
371
+ ]
372
+
373
+ [[package]]
374
+ name = "rustc-hash"
375
+ version = "2.1.4"
376
+ source = "registry+https://github.com/rust-lang/crates.io-index"
377
+ checksum = "ca420ddf5554e546a707e0ecb8bd311d505ee00b40982a7064b8bdc48aa59336"
378
+
379
+ [[package]]
380
+ name = "seq-macro"
381
+ version = "0.3.6"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
384
+
385
+ [[package]]
386
+ name = "serde"
387
+ version = "1.0.229"
388
+ source = "registry+https://github.com/rust-lang/crates.io-index"
389
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
390
+ dependencies = [
391
+ "serde_core",
392
+ "serde_derive",
393
+ ]
394
+
395
+ [[package]]
396
+ name = "serde_core"
397
+ version = "1.0.229"
398
+ source = "registry+https://github.com/rust-lang/crates.io-index"
399
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
400
+ dependencies = [
401
+ "serde_derive",
402
+ ]
403
+
404
+ [[package]]
405
+ name = "serde_derive"
406
+ version = "1.0.229"
407
+ source = "registry+https://github.com/rust-lang/crates.io-index"
408
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
409
+ dependencies = [
410
+ "proc-macro2",
411
+ "quote",
412
+ "syn 3.0.10",
413
+ ]
414
+
415
+ [[package]]
416
+ name = "serde_json"
417
+ version = "1.0.154"
418
+ source = "registry+https://github.com/rust-lang/crates.io-index"
419
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
420
+ dependencies = [
421
+ "foldhash",
422
+ "indexmap",
423
+ "itoa",
424
+ "memchr",
425
+ "serde",
426
+ "serde_core",
427
+ "zmij",
428
+ ]
429
+
430
+ [[package]]
431
+ name = "shell-words"
432
+ version = "1.1.1"
433
+ source = "registry+https://github.com/rust-lang/crates.io-index"
434
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
435
+
436
+ [[package]]
437
+ name = "shlex"
438
+ version = "1.3.0"
439
+ source = "registry+https://github.com/rust-lang/crates.io-index"
440
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
441
+
442
+ [[package]]
443
+ name = "shlex"
444
+ version = "2.0.1"
445
+ source = "registry+https://github.com/rust-lang/crates.io-index"
446
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
447
+
448
+ [[package]]
449
+ name = "syn"
450
+ version = "2.0.119"
451
+ source = "registry+https://github.com/rust-lang/crates.io-index"
452
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
453
+ dependencies = [
454
+ "proc-macro2",
455
+ "quote",
456
+ "unicode-ident",
457
+ ]
458
+
459
+ [[package]]
460
+ name = "syn"
461
+ version = "3.0.10"
462
+ source = "registry+https://github.com/rust-lang/crates.io-index"
463
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
464
+ dependencies = [
465
+ "proc-macro2",
466
+ "quote",
467
+ "unicode-ident",
468
+ ]
469
+
470
+ [[package]]
471
+ name = "unicode-ident"
472
+ version = "1.0.27"
473
+ source = "registry+https://github.com/rust-lang/crates.io-index"
474
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
475
+
476
+ [[package]]
477
+ name = "windows-link"
478
+ version = "0.2.1"
479
+ source = "registry+https://github.com/rust-lang/crates.io-index"
480
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
481
+
482
+ [[package]]
483
+ name = "zmij"
484
+ version = "1.0.23"
485
+ source = "registry+https://github.com/rust-lang/crates.io-index"
486
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
data/Cargo.toml ADDED
@@ -0,0 +1,22 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = ["crates/flog-core", "crates/flog-cli", "ext/flog_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/flog-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
+
20
+ [profile.release]
21
+ lto = true
22
+ codegen-units = 1
data/DIVERGENCES.md ADDED
@@ -0,0 +1,14 @@
1
+ # Deliberate differences from Flog 4.10.0
2
+
3
+ Scores, labels, totals and method locations have no known differences. The
4
+ items below are outside the parity contract.
5
+
6
+ | Difference | Flog 4.10.0 | FlogRs |
7
+ | --- | --- | --- |
8
+ | `Flog#mass` | `{ file => node count of the ruby_parser tree }` | Always `{}`: FlogRs never builds that tree. RubyCritic does not read it. |
9
+ | Message of the `block_pass_even_ickier!` exception | Includes the full sexp, e.g. `{:block_pass_even_ickier!=>s(:gvar, :$x)}` | Same exception class; the message names only the sexp type: `{:block_pass_even_ickier!=>s(:gvar, ...)}` |
10
+ | `timeout` argument of `flog_ruby`/`flog_ruby!` | Parsing is wrapped in `Timeout.timeout(timeout)` | Accepted and ignored |
11
+ | `option` | `Flog#initialize` adds `option[:parser] \|\|= NotRubyParser` | `option` is the options given, without `:parser` |
12
+ | `multiplier=` | Changes the weight of every point scored afterwards | Accepted and ignored: flog-core applies Flog's own multipliers while scoring |
13
+ | `score_method` with Integer tally values above 2**53 | Ruby squares and sums the Integers exactly | Sums and squares as 64-bit floats. Flog's own tallies are always Floats. |
14
+ | Backtrace of `FlogRs::SyntaxError` (printed in the warnings when `quiet` is off) | Frames inside ruby_parser and Prism's translator | The caller's frames |
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,100 @@
1
+ # flog-rs
2
+
3
+ > [!WARNING]
4
+ > This is a vibe coded, pseudo port of the [Flog](https://github.com/seattlerb/flog) 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 `flog-rs` was generated from Ryan Davis's work on [Flog](https://github.com/seattlerb/flog). All credit for the design of the rules this is based on goes to him.
9
+
10
+ See `THIRD_PARTY_NOTICES.md`, for all notices.
11
+
12
+ ## Layout
13
+
14
+ ```
15
+ crates/flog-core/ engine: Prism tree -> tallies -> scores (no ruby_parser tree)
16
+ crates/flog-cli/ flog-rs binary: JSON output, files scored in parallel
17
+ ext/flog_rs/ Ruby binding (Magnus, rb_sys): FlogRs::Flog, the ::Flog API RubyCritic uses
18
+ lib/flog_rs.rb loads the extension
19
+ parity/ oracle runner, comparer, rule fixtures, rule notes
20
+ test/ Ruby tests: FlogRs::Flog against ::Flog 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 flog-rs
31
+ ```
32
+
33
+ As a Rust library or the `flog-rs` binary:
34
+
35
+ ```sh
36
+ cargo add flog-core
37
+ cargo install flog-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/flog_rs/flog_rs.so
47
+ bundle exec rake test # compares with the real flog gem
48
+ cargo test && cargo clippy --all-targets
49
+ cargo build --release -p flog-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 "flog_rs"
62
+
63
+ flog = FlogRs::Flog.new(all: true, continue: true, methods: true)
64
+ flog.flog(*paths) # score files and calculate totals
65
+ flog.reset # clear all results
66
+ flog.total_score # Float (Integer 0 when nothing scored, as in Flog)
67
+ flog.totals # { "Foo#bar" => 12.3, ... }
68
+ flog.average
69
+ flog.calls # { "Foo#bar" => { branch: 1.1, ... } }
70
+ flog.each_by_score(max = nil) { |label, score, tally| ... }
71
+ flog.method_locations # { "Foo#bar" => "app/foo.rb:10-24" }
72
+
73
+ FlogRs.flog_many(paths, options) # { path => FlogRs::Flog }, scored in parallel
74
+ FlogRs::FLOG_COMPAT # "4.10.0"
75
+ ```
76
+
77
+ ## CLI
78
+
79
+ ```sh
80
+ flog-rs [--all] [--methods] [--continue] [--threshold=N] [--ruby-version=V] PATHS...
81
+ flog-rs --per-file [--methods=both|true|false] [--ruby-version=V] PATHS...
82
+ ```
83
+
84
+ ## Parity harness
85
+
86
+ ```sh
87
+ cd parity && bundle install
88
+ ./run.sh # rule fixtures (default)
89
+ ./run.sh path/to/code ... # any files or directories
90
+ ```
91
+
92
+ `run.sh` scores the files with both the original Flog gem (`oracle.rb`) and `flog-rs --per-file`, then `compare.rb` diffs the results.
93
+
94
+ On parity:
95
+ - `parity/RULES.md` lists every rule and fixture
96
+ - `parity/QUIRKS.md` lists behavior from Flog we're intentionally matching
97
+ - `DIVERGENCES.md` lists intentional differences
98
+ ## License
99
+
100
+ MIT (see `LICENSE`). `flog-rs` ports code from Flog and other projects. Their notices are in `THIRD_PARTY_NOTICES.md`.
@@ -0,0 +1,45 @@
1
+ # Third-party notices
2
+
3
+ `flog-rs` ports code from the projects below. Their copyright notices and
4
+ licenses apply to the parts ported from them.
5
+
6
+ ## Flog 4.10.0
7
+
8
+ Scoring rules, method labels and totals (`crates/flog-core`, `ext/flog_rs`).
9
+
10
+ Copyright (c) Ryan Davis, seattle.rb
11
+
12
+ License: MIT (text below).
13
+
14
+ ## Prism 2.1.0
15
+
16
+ `Prism::Translation::RubyParser` (`translation.rs`/`translate.rs`, `attach_comments.rs`).
17
+
18
+ Copyright 2022-present, Ruby developers
19
+
20
+ License: MIT (text below).
21
+
22
+ ## License texts
23
+
24
+ ### MIT
25
+
26
+ ```
27
+ Permission is hereby granted, free of charge, to any person obtaining
28
+ a copy of this software and associated documentation files (the
29
+ "Software"), to deal in the Software without restriction, including
30
+ without limitation the rights to use, copy, modify, merge, publish,
31
+ distribute, sublicense, and/or sell copies of the Software, and to
32
+ permit persons to whom the Software is furnished to do so, subject to
33
+ the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be
36
+ included in all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
42
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
43
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
44
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45
+ ```