piggly-nsd 2.3.3

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.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +170 -0
  3. data/Rakefile +33 -0
  4. data/bin/piggly +8 -0
  5. data/lib/piggly/command/base.rb +148 -0
  6. data/lib/piggly/command/report.rb +162 -0
  7. data/lib/piggly/command/trace.rb +90 -0
  8. data/lib/piggly/command/untrace.rb +78 -0
  9. data/lib/piggly/command.rb +8 -0
  10. data/lib/piggly/compiler/cache_dir.rb +119 -0
  11. data/lib/piggly/compiler/coverage_report.rb +63 -0
  12. data/lib/piggly/compiler/trace_compiler.rb +117 -0
  13. data/lib/piggly/compiler.rb +7 -0
  14. data/lib/piggly/config.rb +80 -0
  15. data/lib/piggly/dumper/index.rb +121 -0
  16. data/lib/piggly/dumper/qualified_name.rb +36 -0
  17. data/lib/piggly/dumper/qualified_type.rb +141 -0
  18. data/lib/piggly/dumper/reified_procedure.rb +172 -0
  19. data/lib/piggly/dumper/skeleton_procedure.rb +112 -0
  20. data/lib/piggly/dumper.rb +9 -0
  21. data/lib/piggly/installer.rb +137 -0
  22. data/lib/piggly/parser/grammar.tt +748 -0
  23. data/lib/piggly/parser/nodes.rb +378 -0
  24. data/lib/piggly/parser/traversal.rb +50 -0
  25. data/lib/piggly/parser/treetop_ruby19_patch.rb +21 -0
  26. data/lib/piggly/parser.rb +69 -0
  27. data/lib/piggly/profile.rb +108 -0
  28. data/lib/piggly/reporter/base.rb +106 -0
  29. data/lib/piggly/reporter/html_dsl.rb +63 -0
  30. data/lib/piggly/reporter/index.rb +114 -0
  31. data/lib/piggly/reporter/procedure.rb +129 -0
  32. data/lib/piggly/reporter/resources/highlight.js +38 -0
  33. data/lib/piggly/reporter/resources/piggly.css +515 -0
  34. data/lib/piggly/reporter/resources/sortable.js +493 -0
  35. data/lib/piggly/reporter.rb +8 -0
  36. data/lib/piggly/tags.rb +280 -0
  37. data/lib/piggly/task.rb +215 -0
  38. data/lib/piggly/util/blankslate.rb +114 -0
  39. data/lib/piggly/util/cacheable.rb +19 -0
  40. data/lib/piggly/util/enumerable.rb +44 -0
  41. data/lib/piggly/util/file.rb +17 -0
  42. data/lib/piggly/util/process_queue.rb +96 -0
  43. data/lib/piggly/util/thunk.rb +39 -0
  44. data/lib/piggly/util.rb +9 -0
  45. data/lib/piggly/version.rb +15 -0
  46. data/lib/piggly.rb +20 -0
  47. data/spec/examples/compiler/cacheable_spec.rb +190 -0
  48. data/spec/examples/compiler/report_spec.rb +25 -0
  49. data/spec/examples/compiler/trace_spec.rb +123 -0
  50. data/spec/examples/config_spec.rb +63 -0
  51. data/spec/examples/dumper/index_spec.rb +199 -0
  52. data/spec/examples/dumper/procedure_spec.rb +116 -0
  53. data/spec/examples/grammar/expression_spec.rb +302 -0
  54. data/spec/examples/grammar/statements/assignment_spec.rb +70 -0
  55. data/spec/examples/grammar/statements/declaration_spec.rb +21 -0
  56. data/spec/examples/grammar/statements/exception_spec.rb +78 -0
  57. data/spec/examples/grammar/statements/if_spec.rb +191 -0
  58. data/spec/examples/grammar/statements/loop_spec.rb +41 -0
  59. data/spec/examples/grammar/statements/sql_spec.rb +71 -0
  60. data/spec/examples/grammar/tokens/comment_spec.rb +58 -0
  61. data/spec/examples/grammar/tokens/datatype_spec.rb +58 -0
  62. data/spec/examples/grammar/tokens/identifier_spec.rb +74 -0
  63. data/spec/examples/grammar/tokens/keyword_spec.rb +44 -0
  64. data/spec/examples/grammar/tokens/label_spec.rb +40 -0
  65. data/spec/examples/grammar/tokens/literal_spec.rb +30 -0
  66. data/spec/examples/grammar/tokens/lval_spec.rb +50 -0
  67. data/spec/examples/grammar/tokens/number_spec.rb +34 -0
  68. data/spec/examples/grammar/tokens/sqlkeywords_spec.rb +45 -0
  69. data/spec/examples/grammar/tokens/string_spec.rb +54 -0
  70. data/spec/examples/grammar/tokens/whitespace_spec.rb +40 -0
  71. data/spec/examples/installer_spec.rb +59 -0
  72. data/spec/examples/parser/nodes_spec.rb +73 -0
  73. data/spec/examples/parser/traversal_spec.rb +14 -0
  74. data/spec/examples/parser_spec.rb +118 -0
  75. data/spec/examples/profile_spec.rb +153 -0
  76. data/spec/examples/reporter/html/dsl_spec.rb +0 -0
  77. data/spec/examples/reporter/html/index_spec.rb +0 -0
  78. data/spec/examples/reporter/html_spec.rb +1 -0
  79. data/spec/examples/reporter_spec.rb +0 -0
  80. data/spec/examples/tags_spec.rb +285 -0
  81. data/spec/examples/task_spec.rb +0 -0
  82. data/spec/examples/util/cacheable_spec.rb +41 -0
  83. data/spec/examples/util/enumerable_spec.rb +64 -0
  84. data/spec/examples/util/file_spec.rb +40 -0
  85. data/spec/examples/util/process_queue_spec.rb +16 -0
  86. data/spec/examples/util/thunk_spec.rb +59 -0
  87. data/spec/examples/version_spec.rb +0 -0
  88. data/spec/issues/007_spec.rb +25 -0
  89. data/spec/issues/008_spec.rb +73 -0
  90. data/spec/issues/018_spec.rb +25 -0
  91. data/spec/issues/028_spec.rb +48 -0
  92. data/spec/issues/032_spec.rb +98 -0
  93. data/spec/issues/036_spec.rb +41 -0
  94. data/spec/spec_helper.rb +312 -0
  95. data/spec/spec_suite.rb +5 -0
  96. metadata +162 -0
@@ -0,0 +1,515 @@
1
+ /* Modern Piggly Code Coverage - Light Theme */
2
+
3
+ :root {
4
+ --color-primary: #3b82f6;
5
+ --color-primary-hover: #2563eb;
6
+ --color-success: #10b981;
7
+ --color-success-light: #d1fae5;
8
+ --color-warning: #f59e0b;
9
+ --color-warning-light: #fef3c7;
10
+ --color-danger: #ef4444;
11
+ --color-danger-light: #fee2e2;
12
+
13
+ --color-bg: #ffffff;
14
+ --color-bg-secondary: #f8fafc;
15
+ --color-bg-tertiary: #f1f5f9;
16
+ --color-border: #e2e8f0;
17
+ --color-border-light: #f1f5f9;
18
+
19
+ --color-text: #1e293b;
20
+ --color-text-secondary: #64748b;
21
+ --color-text-tertiary: #94a3b8;
22
+
23
+ --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
24
+ --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
25
+ --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
26
+
27
+ --radius-sm: 4px;
28
+ --radius-md: 8px;
29
+ --radius-lg: 12px;
30
+
31
+ --font-mono: 'Cascadia Code', 'Fira Code', 'SF Mono', Monaco, 'Consolas', 'Liberation Mono', 'Courier New', monospace;
32
+ --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
33
+ }
34
+
35
+ * {
36
+ margin: 0;
37
+ padding: 0;
38
+ box-sizing: border-box;
39
+ }
40
+
41
+ body {
42
+ color: var(--color-text);
43
+ background-color: var(--color-bg-secondary);
44
+ font-family: var(--font-sans);
45
+ font-size: 14px;
46
+ line-height: 1.6;
47
+ padding: 2rem 3rem;
48
+ min-height: 100vh;
49
+ }
50
+
51
+ a {
52
+ color: var(--color-primary);
53
+ text-decoration: none;
54
+ transition: color 0.2s ease;
55
+ }
56
+
57
+ a:hover {
58
+ color: var(--color-primary-hover);
59
+ text-decoration: underline;
60
+ }
61
+
62
+ a img {
63
+ border: 0;
64
+ }
65
+
66
+ /* HEADER & METADATA */
67
+ .header {
68
+ margin-bottom: 2rem;
69
+ }
70
+
71
+ .timestamp {
72
+ display: inline-block;
73
+ font-family: var(--font-mono);
74
+ font-size: 13px;
75
+ color: var(--color-text-secondary);
76
+ padding: 0.5rem 0;
77
+ margin-top: 2rem;
78
+ }
79
+
80
+ .return {
81
+ display: block;
82
+ width: fit-content;
83
+ margin-left: 1rem;
84
+ padding: 0.5rem 1rem;
85
+ background-color: var(--color-primary);
86
+ color: white;
87
+ border-radius: var(--radius-md);
88
+ font-weight: 500;
89
+ font-size: 14px;
90
+ text-decoration: none !important;
91
+ }
92
+
93
+ .return:hover {
94
+ background-color: var(--color-primary-hover);
95
+ color: white;
96
+ box-shadow: var(--shadow-md);
97
+ }
98
+
99
+ /* CONTAINER & LAYOUT */
100
+ .container {
101
+ display: flex;
102
+ flex-direction: row;
103
+ flex-wrap: nowrap;
104
+ justify-content: space-between;
105
+ align-items: flex-start;
106
+ gap: 2rem;
107
+ padding-bottom: 2rem;
108
+ }
109
+
110
+ /* TABLE OF CONTENTS */
111
+ .toc {
112
+ order: 2;
113
+ flex: 0 0 240px;
114
+ position: sticky;
115
+ top: 2rem;
116
+ max-height: calc(100vh - 4rem);
117
+ overflow-y: auto;
118
+ background: var(--color-bg);
119
+ border: 1px solid var(--color-border);
120
+ border-radius: var(--radius-lg);
121
+ padding: 1.5rem;
122
+ box-shadow: var(--shadow-sm);
123
+ }
124
+
125
+ .toc strong {
126
+ display: block;
127
+ font-size: 16px;
128
+ font-weight: 600;
129
+ color: var(--color-text);
130
+ margin-bottom: 1rem;
131
+ padding-bottom: 0.75rem;
132
+ border-bottom: 2px solid var(--color-border-light);
133
+ }
134
+
135
+ .toc ol {
136
+ margin-left: 1.25rem;
137
+ list-style-position: outside;
138
+ }
139
+
140
+ .toc li {
141
+ font-size: 13px;
142
+ margin-bottom: 0.75rem;
143
+ line-height: 1.5;
144
+ color: var(--color-text-secondary);
145
+ }
146
+
147
+ .toc a {
148
+ color: var(--color-text);
149
+ transition: color 0.2s ease;
150
+ }
151
+
152
+ .toc a:hover {
153
+ color: var(--color-primary);
154
+ }
155
+
156
+ /* CODE LISTING */
157
+ .listing {
158
+ order: 1;
159
+ flex: 1 1 auto;
160
+ background-color: var(--color-bg);
161
+ border: 1px solid var(--color-border);
162
+ border-radius: var(--radius-lg);
163
+ overflow: hidden;
164
+ box-shadow: var(--shadow-sm);
165
+ }
166
+
167
+ .listing table {
168
+ border-collapse: collapse;
169
+ width: 100%;
170
+ }
171
+
172
+ .listing td.signature {
173
+ vertical-align: top;
174
+ padding: 1.25rem 1.5rem;
175
+ white-space: pre;
176
+ border-bottom: 2px solid var(--color-border);
177
+ background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
178
+ color: var(--color-text);
179
+ font-family: var(--font-mono);
180
+ font-size: 13px;
181
+ line-height: 1.6;
182
+ }
183
+
184
+ div.listing td.code {
185
+ vertical-align: top;
186
+ padding: 0.5rem 1rem;
187
+ white-space: pre;
188
+ color: var(--color-text);
189
+ font-family: var(--font-mono);
190
+ font-size: 13px;
191
+ line-height: 1.6;
192
+ width: 100%;
193
+ }
194
+
195
+ div.listing td.lines {
196
+ vertical-align: top;
197
+ padding: 0.5rem 1rem;
198
+ white-space: pre;
199
+ text-align: right;
200
+ background-color: var(--color-bg-tertiary);
201
+ border-right: 1px solid var(--color-border);
202
+ font-size: 13px;
203
+ font-family: var(--font-mono);
204
+ color: var(--color-text-tertiary);
205
+ line-height: 1.6;
206
+ user-select: none;
207
+ min-width: 60px;
208
+ }
209
+
210
+ div.listing td.lines a {
211
+ color: var(--color-text-tertiary);
212
+ text-decoration: none;
213
+ padding: 0 0.25rem;
214
+ display: inline-block;
215
+ transition: color 0.2s ease;
216
+ }
217
+
218
+ div.listing td.lines a:hover {
219
+ color: var(--color-primary);
220
+ }
221
+
222
+ /* SUMMARY SECTION */
223
+ p.summary {
224
+ font-weight: 600;
225
+ font-size: 20px;
226
+ color: var(--color-text);
227
+ margin-bottom: 1rem;
228
+ padding: 1.5rem;
229
+ background: var(--color-bg);
230
+ border-radius: var(--radius-lg);
231
+ border: 1px solid var(--color-border);
232
+ box-shadow: var(--shadow-sm);
233
+ }
234
+
235
+ /* SUMMARY TABLE */
236
+ .table-wrapper {
237
+ max-height: 700px;
238
+ overflow-y: auto;
239
+ overflow-x: auto;
240
+ border-top: 1px solid var(--color-border);
241
+ border-bottom: 1px solid var(--color-border);
242
+ border-radius: var(--radius-lg);
243
+ margin-top: 1rem;
244
+ margin-bottom: 1rem;
245
+ }
246
+
247
+ table.summary {
248
+ width: 100%;
249
+ border-spacing: 0;
250
+ border-collapse: separate;
251
+ background: var(--color-bg);
252
+ border: 1px solid var(--color-border);
253
+ border-radius: var(--radius-lg);
254
+ overflow: visible;
255
+ box-shadow: none;
256
+ }
257
+
258
+ table.summary th {
259
+ padding: 1rem 1.25rem;
260
+ font-weight: 600;
261
+ font-size: 13px;
262
+ text-transform: uppercase;
263
+ letter-spacing: 0.05em;
264
+ color: var(--color-text-secondary);
265
+ background: var(--color-bg-tertiary);
266
+ text-align: center;
267
+ position: sticky;
268
+ top: 0;
269
+ z-index: 10;
270
+ }
271
+
272
+ #sorttable_sortfwdind,
273
+ #sorttable_sortrevind {
274
+ position: absolute;
275
+ right: 0.75rem;
276
+ top: 50%;
277
+ transform: translateY(-50%);
278
+ font-size: 14px;
279
+ color: var(--color-text-secondary);
280
+ }
281
+
282
+ table.summary.sortable th {
283
+ cursor: pointer;
284
+ user-select: none;
285
+ padding-right: 2.5rem;
286
+ position: sticky;
287
+ }
288
+
289
+ table.summary.sortable th:hover {
290
+ background: var(--color-bg-secondary);
291
+ color: var(--color-text-secondary);
292
+ }
293
+
294
+ table.summary td {
295
+ padding: 1rem 1.25rem;
296
+ font-size: 14px;
297
+ color: var(--color-text);
298
+ }
299
+
300
+ table.summary tr.odd,
301
+ table.summary tr.even {
302
+ border-bottom: 1px solid var(--color-border-light);
303
+ transition: background-color 0.2s ease;
304
+ }
305
+
306
+ table.summary tr:hover {
307
+ background-color: var(--color-bg-secondary);
308
+ }
309
+
310
+ table.summary tr:last-child {
311
+ border-bottom: none;
312
+ }
313
+
314
+ table.summary td.file {
315
+ text-align: left;
316
+ font-weight: 500;
317
+ }
318
+
319
+ table.summary td.file a {
320
+ color: var(--color-text);
321
+ font-weight: 500;
322
+ }
323
+
324
+ table.summary td.file a:hover {
325
+ color: var(--color-primary);
326
+ }
327
+
328
+ table.summary td.fail {
329
+ font-weight: 600;
330
+ color: var(--color-danger);
331
+ }
332
+
333
+ table.summary td.count {
334
+ min-width: 80px;
335
+ text-align: center;
336
+ font-weight: 500;
337
+ color: var(--color-text-secondary);
338
+ }
339
+
340
+ table.summary td.pct {
341
+ min-width: 140px;
342
+ text-align: center;
343
+ }
344
+
345
+ table.summary td.pct td.num {
346
+ padding: 0;
347
+ min-width: 65px;
348
+ text-align: center;
349
+ border: 0;
350
+ font-size: 13px;
351
+ font-weight: 600;
352
+ }
353
+
354
+ table.summary td.pct td.graph {
355
+ padding: 0;
356
+ min-width: 80px;
357
+ text-align: center;
358
+ border: 0;
359
+ }
360
+
361
+ table.summary td.pct table {
362
+ font-size: 85%;
363
+ padding: 0;
364
+ border-spacing: 0;
365
+ border-collapse: collapse;
366
+ margin: 0 auto;
367
+ }
368
+
369
+ /* COVERAGE GRAPH */
370
+ table.graph {
371
+ min-width: 80px;
372
+ max-width: 80px;
373
+ padding: 0;
374
+ border: 1px solid var(--color-border);
375
+ border-spacing: 0;
376
+ height: 20px;
377
+ border-radius: var(--radius-sm);
378
+ overflow: hidden;
379
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
380
+ }
381
+
382
+ table.graph td {
383
+ border: 0;
384
+ padding: 0;
385
+ height: 100%;
386
+ }
387
+
388
+ /* Zero coverage (0%) */
389
+ table.zero td.covered {
390
+ background-color: var(--color-danger-light);
391
+ width: 100% !important;
392
+ }
393
+
394
+ /* Low coverage (0-30%) */
395
+ table.low td.covered {
396
+ background-color: var(--color-danger);
397
+ }
398
+ table.low td.uncovered {
399
+ background-color: var(--color-danger-light);
400
+ }
401
+
402
+ /* Mid coverage (31-60%) */
403
+ table.mid td.covered {
404
+ background-color: var(--color-warning);
405
+ }
406
+ table.mid td.uncovered {
407
+ background-color: var(--color-warning-light);
408
+ }
409
+
410
+ /* High coverage (61-99%) */
411
+ table.high td.covered {
412
+ background-color: var(--color-success);
413
+ }
414
+ table.high td.uncovered {
415
+ background-color: var(--color-success-light);
416
+ }
417
+
418
+ /* Full coverage (100%) */
419
+ table.full td.covered {
420
+ background-color: var(--color-success);
421
+ width: 100% !important;
422
+ }
423
+
424
+ /* SYNTAX HIGHLIGHTING - Modern color scheme */
425
+ .tI { color: #475569; } /* identifier - slate-600 */
426
+ .tD { color: #7c3aed; font-style: italic; } /* data type - violet-600 */
427
+ .tK { color: #dc2626; font-weight: 500; } /* keyword - red-600 */
428
+ .tC { color: #6366f1; font-style: italic; } /* comment - indigo-500 */
429
+ .tQ { color: #059669; font-style: italic; } /* sql statement - emerald-600 */
430
+ .tS { color: #10b981; } /* string literal - emerald-500 */
431
+ .tL { color: #ea580c; font-style: italic; } /* label - orange-600 */
432
+ .tM { color: var(--color-text-secondary); } /* dollar quote marker */
433
+
434
+ /* CODE BLOCKS */
435
+ .b {
436
+ display: block;
437
+ width: 100%;
438
+ margin: 0;
439
+ padding: 0;
440
+ }
441
+
442
+ .i {
443
+ display: inline;
444
+ }
445
+
446
+ /* LINE WITH INCOMPLETE COVERAGE */
447
+ .lU {
448
+ display: block;
449
+ background: var(--color-danger-light);
450
+ margin: 0;
451
+ padding: 0;
452
+ border: none;
453
+ border-left: 3px solid var(--color-danger);
454
+ }
455
+
456
+ /* BLOCK EXECUTION */
457
+ .c0 {
458
+ font-weight: 600;
459
+ color: var(--color-danger);
460
+ }
461
+
462
+ .c1 {
463
+ color: var(--color-text);
464
+ }
465
+
466
+ /* LOOP COVERAGE */
467
+ .l0000, .l0001, .l0010, .l0100, .l0011, .l0101, .l0110, .l0111,
468
+ .l1000, .l1001, .l1010, .l1100, .l1011, .l1101, .l1110 {
469
+ font-weight: 600;
470
+ color: var(--color-warning);
471
+ }
472
+
473
+ .l1111 {
474
+ color: var(--color-text);
475
+ }
476
+
477
+ /* BRANCH DECISIONS */
478
+ .b00 {
479
+ font-weight: 600;
480
+ color: var(--color-danger);
481
+ }
482
+
483
+ .b01 {
484
+ font-weight: 600;
485
+ color: #10b981;
486
+ }
487
+
488
+ .b10 {
489
+ font-weight: 600;
490
+ color: #f59e0b;
491
+ }
492
+
493
+ .b11 {
494
+ color: var(--color-text);
495
+ }
496
+
497
+ /* SCROLLBAR STYLING (for webkit browsers) */
498
+ ::-webkit-scrollbar {
499
+ width: 10px;
500
+ height: 10px;
501
+ }
502
+
503
+ ::-webkit-scrollbar-track {
504
+ background: var(--color-bg-tertiary);
505
+ border-radius: var(--radius-sm);
506
+ }
507
+
508
+ ::-webkit-scrollbar-thumb {
509
+ background: var(--color-border);
510
+ border-radius: var(--radius-sm);
511
+ }
512
+
513
+ ::-webkit-scrollbar-thumb:hover {
514
+ background: var(--color-text-tertiary);
515
+ }