-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint.log
More file actions
1607 lines (1518 loc) · 65.8 KB
/
lint.log
File metadata and controls
1607 lines (1518 loc) · 65.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$ ultracite check
Checking formatting...
All matched files use the correct format.
Finished in 499ms on 146 files using 12 threads.
x vitest(expect-expect): Test has no assertions
,-[tests/integration/gitlab-templates/infrastructure.test.ts:16:3]
15 | describe("GitLab Templates: Infrastructure", () => {
16 | it("should handle OpenTofu.latest template", async () => {
: ^^
17 | const yaml = loadLocalTemplate(
`----
help: Add assertion(s) in this Test
x vitest(expect-expect): Test has no assertions
,-[tests/integration/gitlab-templates/infrastructure.test.ts:24:3]
23 |
24 | it("should handle Code-Quality template", async () => {
: ^^
25 | const yaml = loadLocalTemplate(testFilesDir, "Code-Quality.gitlab-ci.yml")
`----
help: Add assertion(s) in this Test
x vitest(expect-expect): Test has no assertions
,-[tests/integration/gitlab-templates/infrastructure.test.ts:29:3]
28 |
29 | it("should handle Getting-Started template", async () => {
: ^^
30 | const yaml = loadLocalTemplate(
`----
help: Add assertion(s) in this Test
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/remote-extends-normalization.test.ts:55:7]
54 | if (Array.isArray(extendsValue)) {
55 | expect(extendsValue).not.toHaveLength(5)
: ^^^^^^
56 | expect(extendsValue).not.toStrictEqual([".", "b", "a", "s", "e"])
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/remote-extends-normalization.test.ts:56:7]
55 | expect(extendsValue).not.toHaveLength(5)
56 | expect(extendsValue).not.toStrictEqual([".", "b", "a", "s", "e"])
: ^^^^^^
57 | }
`----
help: Avoid calling `expect` conditionally
x unicorn(prefer-module): Do not use "__dirname".
,-[tests/integration/multi-document-yaml/multi-document-yaml.test.ts:17:18]
16 |
17 | const TEST_DIR = __dirname
: ^^^^^^^^^
18 | const TEST_FILES_DIR = join(TEST_DIR, "test_files")
`----
help: Prefer ES modules over CommonJS globals.
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/integration/multi-document-yaml/opentofu-component.test.ts:85:7]
84 | const inputKeys = Object.keys(inputs)
85 | expect(inputKeys.length).toBeGreaterThan(0)
: ^^^^^^
86 |
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/integration/multi-document-yaml/opentofu-component.test.ts:88:7]
87 | // Check for some key inputs
88 | expect(inputKeys).toContain("as")
: ^^^^^^
89 | expect(inputKeys).toContain("stage")
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/integration/multi-document-yaml/opentofu-component.test.ts:89:7]
88 | expect(inputKeys).toContain("as")
89 | expect(inputKeys).toContain("stage")
: ^^^^^^
90 | expect(inputKeys).toContain("opentofu_version")
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/integration/multi-document-yaml/opentofu-component.test.ts:90:7]
89 | expect(inputKeys).toContain("stage")
90 | expect(inputKeys).toContain("opentofu_version")
: ^^^^^^
91 | }
`----
help: Avoid calling `expect` conditionally
x unicorn(prefer-module): Do not use "__dirname".
,-[tests/integration/multi-document-yaml/opentofu-component.test.ts:17:18]
16 |
17 | const TEST_DIR = __dirname
: ^^^^^^^^^
18 | const TEST_FILES_DIR = join(TEST_DIR, "test_files")
`----
help: Prefer ES modules over CommonJS globals.
x eslint(no-unused-vars): Variable 'someValue' is declared but never used. Unused variables should start with a '_'.
,-[tests/unit/fixtures/no-export.mjs:4:7]
3 |
4 | const someValue = "test"
: ^^^^|^^^^
: `-- 'someValue' is declared here
`----
help: Consider removing this declaration.
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/reference-array-flattening.test.ts:29:7]
28 | if (Array.isArray(testJob?.script)) {
29 | expect(testJob.script).toStrictEqual([
: ^^^^^^
30 | "echo 'first'",
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/reference-array-flattening.test.ts:63:7]
62 | if (Array.isArray(testJob?.script)) {
63 | expect(testJob.script).toStrictEqual([
: ^^^^^^
64 | "echo 'before'",
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/reference-array-flattening.test.ts:102:7]
101 | if (Array.isArray(testJob?.before_script)) {
102 | expect(testJob.before_script).toStrictEqual([
: ^^^^^^
103 | "echo 'load secrets'",
`----
help: Avoid calling `expect` conditionally
x vitest(no-conditional-expect): Unexpected conditional expect
,-[tests/unit/reference-array-flattening.test.ts:112:7]
111 | if (Array.isArray(testJob.after_script)) {
112 | expect(testJob.after_script).toStrictEqual([
: ^^^^^^
113 | "echo 'custom cleanup'",
`----
help: Avoid calling `expect` conditionally
x unicorn(no-immediate-mutation): Do not call `push()` immediately after initializing an array.
,-[src/importer/ts-factory/generator.ts:72:5]
71 | // Add import
72 | statements.push(this.createImport())
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73 |
`----
help: Move the elements from `push()` into the array initializer.
x eslint(class-methods-use-this): Expected method `createBodyStatements` to have this.
,-[src/importer/ts-factory/generator.ts:148:11]
147 | */
148 | private createBodyStatements(
: ^^^^^^^^^^^^^^^^^^^^
149 | topLevel: {
`----
help: Consider converting method `createBodyStatements` to a static method.
x import(no-named-as-default-member): "yaml" also has a named export "Type"
,-[src/importer/yaml-parser/reference.ts:7:33]
6 | */
7 | export const referenceTag = new yaml.Type("!reference", {
: ^^^^^^^^^
8 | kind: "sequence",
`----
help: Check if you meant to write `import { Type } from "js-yaml"`
x import(no-named-as-default-member): "yaml" also has a named export "Type"
,-[src/importer/yaml-parser/reference.ts:17:43]
16 | */
17 | export const referenceTagResolvable = new yaml.Type("!reference", {
: ^^^^^^^^^
18 | kind: "sequence",
`----
help: Check if you meant to write `import { Type } from "js-yaml"`
x unicorn(consistent-function-scoping): Function `isTemplate` does not capture any variables from its parent scope
,-[src/simulation/pipeline-simulator.ts:146:11]
145 | // Helper to check if a job is a template (starts with .)
146 | const isTemplate = (name: string): boolean => name.startsWith(".")
: ^^^^^^^^^^
147 |
`----
help: Move `isTemplate` to the outer scope to avoid recreating it on every call.
x unicorn(consistent-function-scoping): Function `shouldIncludeJob` does not capture any variables from its parent scope
,-[src/simulation/pipeline-simulator.ts:149:11]
148 | // Helper to check if a job should be included in simulation
149 | const shouldIncludeJob = (job: JobDefinitionNormalized): boolean => {
: ^^^^^^^^^^^^^^^^
150 | // A job must have at least one of these to be executable:
`----
help: Move `shouldIncludeJob` to the outer scope to avoid recreating it on every call.
x eslint(complexity): function has a complexity of 21. Maximum allowed is 20.
,-[src/simulation/pipeline-simulator.ts:149:30]
148 | // Helper to check if a job should be included in simulation
149 | ,-> const shouldIncludeJob = (job: JobDefinitionNormalized): boolean => {
150 | | // A job must have at least one of these to be executable:
151 | | // - script or run (actual commands to execute)
152 | | // - trigger (child pipeline or multi-project pipeline)
153 | | // - needs with pipeline keyword (parent-child pipeline trigger)
154 | | // - release (create a GitLab release)
155 | | // - pages (GitLab Pages deployment)
156 | | if (job.script ?? job.run) {
157 | | return true
158 | | }
159 | | if (job.trigger) {
160 | | return true
161 | | }
162 | | if (job.release) {
163 | | return true
164 | | }
165 | | if (job.pages) {
166 | | return true
167 | | }
168 | |
169 | | // Check if this is a child pipeline trigger via needs
170 | | if (job.needs && Array.isArray(job.needs)) {
171 | | const hasPipelineTrigger = job.needs.some((need) => {
172 | | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
173 | | if (typeof need === "object" && need !== null) {
174 | | return "pipeline" in need
175 | | }
176 | | return false
177 | | })
178 | | if (hasPipelineTrigger) {
179 | | return true
180 | | }
181 | | }
182 | |
183 | | // Special case: Jobs that have a stage defined (not using default 'test')
184 | | // are likely real jobs where the script comes from remote includes
185 | | // Include them if they have any content beyond just the stage
186 | | if (job.stage && job.stage !== "test") {
187 | | // If the job has variables, rules, or other config, it's likely a real job
188 | | // being configured locally with the actual implementation in a remote include
189 | | const hasConfig =
190 | | (job.variables && Object.keys(job.variables).length > 0) ??
191 | | (job.rules && job.rules.length > 0) ??
192 | | job.image ??
193 | | job.before_script ??
194 | | job.after_script ??
195 | | job.tags ??
196 | | job.only ??
197 | | job.except
198 | | if (hasConfig) {
199 | | return true
200 | | }
201 | | }
202 | |
203 | | // Jobs with only variables/stage/tags/etc and no other content
204 | | // are pure template jobs that are meant to be extended
205 | | return false
206 | `-> }
207 |
`----
x unicorn(prefer-ternary): Prefer ternary expressions over simple `if-else` statements.
,-[src/simulation/pipeline-simulator.ts:87:9]
86 | for (const [key, val] of Object.entries(plain.variables)) {
87 | ,-> if (val && typeof val === "object" && "value" in val) {
88 | | globalVariables[key] = String(val.value)
89 | | } else {
90 | | globalVariables[key] = String(val)
91 | `-> }
92 | }
`----
help: Rewrite this `if`/`else` as a ternary expression.
x unicorn(prefer-ternary): Prefer ternary expressions over simple `if-else` statements.
,-[src/simulation/pipeline-simulator.ts:284:9]
283 | // JobVariable can be string | number | boolean | { value: string, expand?: boolean }
284 | ,-> if (val && typeof val === "object" && "value" in val) {
285 | | jobVariables[key] = String(val.value)
286 | | } else {
287 | | jobVariables[key] = String(val)
288 | `-> }
289 | }
`----
help: Rewrite this `if`/`else` as a ternary expression.
x eslint(complexity): private method `evaluateCondition` has a complexity of 35. Maximum allowed is 20.
,-[src/simulation/rule-evaluator.ts:138:28]
137 | */
138 | ,-> private evaluateCondition(condition: string, context: RuleContext): boolean {
139 | | // Handle && operator (AND logic)
140 | | if (condition.includes(" && ")) {
141 | | const parts = condition.split(" && ")
142 | | return parts.every((part) => this.evaluateCondition(part.trim(), context))
143 | | }
144 | |
145 | | // Handle || operator (OR logic)
146 | | if (condition.includes(" || ")) {
147 | | const parts = condition.split(" || ")
148 | | return parts.some((part) => this.evaluateCondition(part.trim(), context))
149 | | }
150 | |
151 | | // $VAR_NAME == $OTHER_VAR (variable-to-variable comparison)
152 | | const varToVarMatchRegex = /\$(\w+)\s*==\s*\$(\w+)/
153 | | const varToVarMatch = varToVarMatchRegex.exec(condition)
154 | | if (varToVarMatch) {
155 | | const var1 = varToVarMatch[1]
156 | | const var2 = varToVarMatch[2]
157 | | if (!var1 || !var2) {
158 | | return false
159 | | }
160 | | return context.variables[var1] === context.variables[var2]
161 | | }
162 | |
163 | | // $VAR_NAME != $OTHER_VAR (variable-to-variable not equal)
164 | | const varToVarNotMatchRegex = /\$(\w+)\s*!=\s*\$(\w+)/
165 | | const varToVarNotMatch = varToVarNotMatchRegex.exec(condition)
166 | | if (varToVarNotMatch) {
167 | | const var1 = varToVarNotMatch[1]
168 | | const var2 = varToVarNotMatch[2]
169 | | if (!var1 || !var2) {
170 | | return false
171 | | }
172 | | return context.variables[var1] !== context.variables[var2]
173 | | }
174 | |
175 | | // $VAR_NAME == "value"
176 | | const exactMatchRegex = /\$(\w+)\s*==\s*["'](.+?)["']/
177 | | const exactMatch = exactMatchRegex.exec(condition)
178 | | if (exactMatch) {
179 | | const varName = exactMatch[1]
180 | | const value = exactMatch[2]
181 | | if (!varName || !value) {
182 | | return false
183 | | }
184 | | return context.variables[varName] === value
185 | | }
186 | |
187 | | // $VAR_NAME != "value"
188 | | const notMatchRegex = /\$(\w+)\s*!=\s*["'](.+?)["']/
189 | | const notMatch = notMatchRegex.exec(condition)
190 | | if (notMatch) {
191 | | const varName = notMatch[1]
192 | | const value = notMatch[2]
193 | | if (!varName || !value) {
194 | | return false
195 | | }
196 | | return context.variables[varName] !== value
197 | | }
198 | |
199 | | // $VAR_NAME =~ /pattern/iu (regex match, case insensitive)
200 | | const regexMatchRegex = /\$(\w+)\s*=~\s*\/(.+?)\/([i]?)/
201 | | const regexMatch = regexMatchRegex.exec(condition)
202 | | if (regexMatch) {
203 | | const varName = regexMatch[1]
204 | | const pattern = regexMatch[2]
205 | | const flags = regexMatch[3]
206 | | if (!varName || !pattern) {
207 | | return false
208 | | }
209 | | const value = context.variables[varName] ?? ""
210 | | const regex = new RegExp(pattern, flags)
211 | | return regex.test(value)
212 | | }
213 | |
214 | | // $VAR_NAME !~ /pattern/iu (regex not match)
215 | | const regexNotMatchRegex = /\$(\w+)\s*!~\s*\/(.+?)\/([i]?)/
216 | | const regexNotMatch = regexNotMatchRegex.exec(condition)
217 | | if (regexNotMatch) {
218 | | const varName = regexNotMatch[1]
219 | | const pattern = regexNotMatch[2]
220 | | const flags = regexNotMatch[3]
221 | | if (!varName || !pattern) {
222 | | return false
223 | | }
224 | | const value = context.variables[varName] ?? ""
225 | | const regex = new RegExp(pattern, flags)
226 | | return !regex.test(value)
227 | | }
228 | |
229 | | // $VAR_NAME (variable exists and is truthy)
230 | | const varExistsRegex = /^\$(\w+)$/
231 | | const varExists = varExistsRegex.exec(condition)
232 | | if (varExists) {
233 | | const varName = varExists[1]
234 | | if (!varName) {
235 | | return false
236 | | }
237 | | const value = context.variables[varName]
238 | | return (
239 | | value !== undefined &&
240 | | value !== "" &&
241 | | value !== "false" &&
242 | | value !== "0"
243 | | )
244 | | }
245 | |
246 | | // $CI_COMMIT_BRANCH (special variables)
247 | | if (condition === "$CI_COMMIT_BRANCH" && context.branch) {
248 | | return true
249 | | }
250 | |
251 | | if (condition === "$CI_COMMIT_TAG" && context.tag) {
252 | | return true
253 | | }
254 | |
255 | | // $CI_MERGE_REQUEST_ID (merge request check)
256 | | if (condition === "$CI_MERGE_REQUEST_ID") {
257 | | return !!context.mergeRequestLabels
258 | | }
259 | |
260 | | // $CI_PIPELINE_SOURCE == "merge_request_event"
261 | | const pipelineSourceRegex = /\$CI_PIPELINE_SOURCE\s*==\s*["'](.+?)["']/
262 | | const pipelineSource = pipelineSourceRegex.exec(condition)
263 | | if (pipelineSource) {
264 | | const [, source] = pipelineSource
265 | | if (source === "merge_request_event") {
266 | | return !!context.mergeRequestLabels
267 | | }
268 | | // For other sources, assume they don't match in simulation
269 | | return false
270 | | }
271 | |
272 | | // Default: assume condition doesn't match
273 | | return false
274 | `-> }
275 |
`----
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:155:20]
154 | if (varToVarMatch) {
155 | const var1 = varToVarMatch[1]
: ^^^^^^^^^^^^^^^^
156 | const var2 = varToVarMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:156:20]
155 | const var1 = varToVarMatch[1]
156 | const var2 = varToVarMatch[2]
: ^^^^^^^^^^^^^^^^
157 | if (!var1 || !var2) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:167:20]
166 | if (varToVarNotMatch) {
167 | const var1 = varToVarNotMatch[1]
: ^^^^^^^^^^^^^^^^^^^
168 | const var2 = varToVarNotMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:168:20]
167 | const var1 = varToVarNotMatch[1]
168 | const var2 = varToVarNotMatch[2]
: ^^^^^^^^^^^^^^^^^^^
169 | if (!var1 || !var2) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:179:23]
178 | if (exactMatch) {
179 | const varName = exactMatch[1]
: ^^^^^^^^^^^^^
180 | const value = exactMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:180:21]
179 | const varName = exactMatch[1]
180 | const value = exactMatch[2]
: ^^^^^^^^^^^^^
181 | if (!varName || !value) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:191:23]
190 | if (notMatch) {
191 | const varName = notMatch[1]
: ^^^^^^^^^^^
192 | const value = notMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:192:21]
191 | const varName = notMatch[1]
192 | const value = notMatch[2]
: ^^^^^^^^^^^
193 | if (!varName || !value) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:203:23]
202 | if (regexMatch) {
203 | const varName = regexMatch[1]
: ^^^^^^^^^^^^^
204 | const pattern = regexMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:204:23]
203 | const varName = regexMatch[1]
204 | const pattern = regexMatch[2]
: ^^^^^^^^^^^^^
205 | const flags = regexMatch[3]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:205:21]
204 | const pattern = regexMatch[2]
205 | const flags = regexMatch[3]
: ^^^^^^^^^^^^^
206 | if (!varName || !pattern) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:218:23]
217 | if (regexNotMatch) {
218 | const varName = regexNotMatch[1]
: ^^^^^^^^^^^^^^^^
219 | const pattern = regexNotMatch[2]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:219:23]
218 | const varName = regexNotMatch[1]
219 | const pattern = regexNotMatch[2]
: ^^^^^^^^^^^^^^^^
220 | const flags = regexNotMatch[3]
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:220:21]
219 | const pattern = regexNotMatch[2]
220 | const flags = regexNotMatch[3]
: ^^^^^^^^^^^^^^^^
221 | if (!varName || !pattern) {
`----
help: Use array destructuring rather than direct member access.
x eslint(prefer-destructuring): Use Array destructuring.
,-[src/simulation/rule-evaluator.ts:233:23]
232 | if (varExists) {
233 | const varName = varExists[1]
: ^^^^^^^^^^^^
234 | if (!varName) {
`----
help: Use array destructuring rather than direct member access.
x eslint(class-methods-use-this): Expected method `interpolateVariables` to have this.
,-[src/simulation/rule-evaluator.ts:124:11]
123 | */
124 | private interpolateVariables(
: ^^^^^^^^^^^^^^^^^^^^
125 | str: string,
`----
help: Consider converting method `interpolateVariables` to a static method.
x vitest(prefer-hooks-in-order): Test hooks are not in a consistent order.
,-[tests/integration/cli/remote-includes.test.ts:157:3]
156 | beforeAll(() => server.listen({ onUnhandledRequest: "error" }))
157 | afterAll(() => server.close())
: ^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^
: `-- "afterEach" hook should be called before this
158 | afterEach(() => server.resetHandlers())
: ^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^
: `-- this should be moved to before the "afterAll" hook
159 | it("should resolve and visualize YAML with remote include via HTTP", async () => {
`----
help: "afterEach" hooks should be before any "afterAll" hooks
x eslint(complexity): function `loadChildPipelineConfig` has a complexity of 22. Maximum allowed is 20.
,-[src/resolution/child-pipeline.ts:48:1]
47 | */
48 | ,-> function loadChildPipelineConfig(
49 | | triggerInclude: unknown,
50 | | basePath?: string
51 | | ): { config: ConfigBuilder; source: string } | null {
52 | | if (!triggerInclude || typeof triggerInclude !== "object") {
53 | | return null
54 | | }
55 | |
56 | | const include = triggerInclude as Record<string, unknown>
57 | |
58 | | // Handle local file includes
59 | | if ("local" in include && typeof include.local === "string") {
60 | | try {
61 | | const filePath = basePath
62 | | ? resolve(basePath, include.local)
63 | | : include.local
64 | | const yamlContent = readFileSync(filePath, "utf-8")
65 | | const parsed = parseYaml(yamlContent)
66 | |
67 | | const config = new ConfigBuilder()
68 | |
69 | | // Handle empty or null parsed result
70 | | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
71 | | if (!parsed || typeof parsed !== "object") {
72 | | return { config, source: include.local }
73 | | }
74 | |
75 | | // Add stages
76 | | if (parsed.stages) {
77 | | config.stages(
78 | | ...((Array.isArray(parsed.stages)
79 | | ? parsed.stages
80 | | : [parsed.stages]) as string[])
81 | | )
82 | | }
83 | |
84 | | // Add jobs and templates
85 | | for (const [name, definition] of Object.entries(parsed)) {
86 | | if (
87 | | typeof definition === "object" &&
88 | | definition !== null &&
89 | | ![
90 | | "stages",
91 | | "variables",
92 | | "workflow",
93 | | "include",
94 | | "default",
95 | | "spec",
96 | | ].includes(name)
97 | | ) {
98 | | try {
99 | | if (name.startsWith(".")) {
100 | | config.template(name, definition)
101 | | } else {
102 | | config.job(name, definition)
103 | | }
104 | | } catch {
105 | | // Skip invalid jobs
106 | | }
107 | | }
108 | | }
109 | |
110 | | return { config, source: include.local }
111 | | } catch {
112 | | return null
113 | | }
114 | | }
115 | |
116 | | // Handle artifact includes (can't be loaded at build time)
117 | | if ("artifact" in include && typeof include.artifact === "string") {
118 | | return {
119 | | config: new ConfigBuilder(),
120 | | source: `artifact:${include.artifact}`,
121 | | }
122 | | }
123 | |
124 | | // Handle array of includes
125 | | if (Array.isArray(include)) {
126 | | for (const item of include) {
127 | | const result = loadChildPipelineConfig(item, basePath)
128 | | if (result) {
129 | | return result
130 | | }
131 | | }
132 | | }
133 | |
134 | | return null
135 | `-> }
136 |
`----
x import(no-cycle): Dependency cycle detected
,-[src/resolution/child-pipeline.ts:4:31]
3 |
4 | import { ConfigBuilder } from "../builder"
: ^^^^^^^^^^^^
5 | import { parseYaml } from "../importer/parser"
`----
help: Refactor to remove the cycle. Consider extracting shared code into a separate module that both files can import.
note: These paths form a cycle:
╭──▶ ../builder (src/builder/index.ts)
│ ⬇ imports
│ ./ConfigBuilder (src/builder/ConfigBuilder.ts)
│ ⬇ imports
│ ../resolution (src/resolution/index.ts)
│ ⬇ imports
│ ./child-pipeline (src/resolution/child-pipeline.ts)
╰─────────╯ imports the current file
x oxc(no-barrel-file): Barrel file detected, 203 modules are loaded which exceeds the threshold of 100.
,-[src/simulation/index.ts:1:15]
1 | export * from "./pipeline-simulator"
: ^^^^^^^^^^^|^^^^^^^^^^
: `-- 117 modules
2 | export * from "./rule-evaluator"
: ^^^^^^^^^|^^^^^^^^
: `-- 84 modules
`----
help: Consider importing directly from the specific modules instead of using `export *` or `import *`.
Loading 203 modules may be slow for runtimes and bundlers.
note: See: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7
x oxc(no-barrel-file): Barrel file detected, 852 modules are loaded which exceeds the threshold of 100.
,-[src/index.ts:1:15]
1 | export * from "./schema"
: ^^^^^|^^^^
: `-- 90 modules
2 | export * from "./merge"
: ^^^^|^^^^
: `-- 92 modules
3 | export * from "./resolution"
: ^^^^^^^|^^^^^^
: `-- 116 modules
4 | export * from "./model"
: ^^^^|^^^^
: `-- 92 modules
5 | export * from "./builder"
: ^^^^^|^^^^^
: `-- 116 modules
6 | export * from "./serializer"
: ^^^^^^^|^^^^^^
: `-- 95 modules
7 | export * from "./importer"
: ^^^^^^|^^^^^
: `-- 8 modules
8 | export * from "./resolver"
: ^^^^^^|^^^^^
: `-- 116 modules
9 | export * from "./simulation"
: ^^^^^^^|^^^^^^
: `-- 118 modules
10 | export { ConfigBuilder } from "./builder/ConfigBuilder"
`----
help: Consider importing directly from the specific modules instead of using `export *` or `import *`.
Loading 852 modules may be slow for runtimes and bundlers.
note: See: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7
x eslint(no-useless-return): Unnecessary return statement.
,-[src/schema/interpolation.ts:42:5]
41 | if (isGitLabInterpolation(value)) {
42 | return
: ^^^^^^
43 | }
`----
help: Remove this redundant `return` statement.
x oxc(no-barrel-file): Barrel file detected, 815 modules are loaded which exceeds the threshold of 100.
,-[src/schema/index.ts:1:15]
1 | export * from "./base"
: ^^^^|^^^
: `-- 80 modules
2 | export * from "./defaults"
: ^^^^^^|^^^^^
: `-- 84 modules
3 | export * from "./errors"
: ^^^^^|^^^^
: `-- 79 modules
4 | export * from "./include"
: ^^^^^|^^^^^
: `-- 84 modules
5 | export * from "./interpolation"
: ^^^^^^^^|^^^^^^^^
: `-- 79 modules
6 | export * from "./job"
: ^^^|^^^
: `-- 83 modules
7 | export * from "./policies"
: ^^^^^^|^^^^^
: `-- 79 modules
8 | export * from "./spec"
: ^^^^|^^^
: `-- 79 modules
9 | export * from "./steps"
: ^^^^|^^^^
: `-- 79 modules
10 | export * from "./workflow"
: ^^^^^^|^^^^^
: `-- 79 modules
11 |
`----
help: Consider importing directly from the specific modules instead of using `export *` or `import *`.
Loading 815 modules may be slow for runtimes and bundlers.
note: See: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7
x unicorn(filename-case): Filename should be in kebab-case
,-[src/builder/ConfigBuilder.ts:1:1]
1 | import fs from "node:fs/promises"
: ^
2 | import path from "node:path"
`----
help: Rename the file to 'config-builder.ts'
x import(no-cycle): Dependency cycle detected
,-[src/builder/ConfigBuilder.ts:9:61]
8 | import { PipelineState } from "../model"
9 | import type { ExtendsGraphNode, VisualizationOptions } from "../resolution"
: ^^^^^^^^^^^^^^^
10 | import {
`----
help: Refactor to remove the cycle. Consider extracting shared code into a separate module that both files can import.
note: These paths form a cycle:
╭──▶ ../resolution (src/resolution/index.ts)
│ ⬇ imports
│ ./child-pipeline (src/resolution/child-pipeline.ts)
│ ⬇ imports
│ ../builder (src/builder/index.ts)
│ ⬇ imports
│ ./ConfigBuilder (src/builder/ConfigBuilder.ts)
╰─────────╯ imports the current file
x import(no-cycle): Dependency cycle detected
,-[src/builder/ConfigBuilder.ts:16:32]
15 | } from "../resolution"
16 | import { resolveExtends } from "../resolver"
: ^^^^^^^^^^^^^
17 | import type {
`----
help: Refactor to remove the cycle. Consider extracting shared code into a separate module that both files can import.
note: These paths form a cycle:
╭──▶ ../resolver (src/resolver/index.ts)
│ ⬇ imports
│ ./cli (src/resolver/cli.ts)
│ ⬇ imports
│ ../builder (src/builder/index.ts)
│ ⬇ imports
│ ./ConfigBuilder (src/builder/ConfigBuilder.ts)
╰─────────╯ imports the current file
x unicorn(filename-case): Filename should be in kebab-case
,-[src/builder/JobBuilder.ts:1:1]
1 | import type {
: ^
2 | Artifacts,
`----
help: Rename the file to 'job-builder.ts'
x oxc(no-barrel-file): Barrel file detected, 326 modules are loaded which exceeds the threshold of 100.
,-[src/resolution/index.ts:1:15]
1 | export * from "./graph"
: ^^^^|^^^^
: `-- 91 modules
2 | export * from "./visualization"
: ^^^^^^^^|^^^^^^^^
: `-- 116 modules
3 | export * from "./child-pipeline"
: ^^^^^^^^^|^^^^^^^^
: `-- 116 modules
`----
help: Consider importing directly from the specific modules instead of using `export *` or `import *`.
Loading 326 modules may be slow for runtimes and bundlers.
note: See: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7
x import(no-cycle): Dependency cycle detected
,-[src/resolution/index.ts:3:15]
2 | export * from "./visualization"
3 | export * from "./child-pipeline"
: ^^^^^^^^^^^^^^^^^^
`----
help: Refactor to remove the cycle. Consider extracting shared code into a separate module that both files can import.
note: These paths form a cycle:
╭──▶ ./child-pipeline (src/resolution/child-pipeline.ts)
│ ⬇ imports
│ ../builder (src/builder/index.ts)
│ ⬇ imports
│ ./ConfigBuilder (src/builder/ConfigBuilder.ts)
│ ⬇ imports
│ ../resolution (src/resolution/index.ts)
╰─────────╯ imports the current file
x import(no-cycle): Dependency cycle detected
,-[src/resolution/index.ts:2:15]
1 | export * from "./graph"
2 | export * from "./visualization"
: ^^^^^^^^^^^^^^^^^
3 | export * from "./child-pipeline"
`----
help: Refactor to remove the cycle. Consider extracting shared code into a separate module that both files can import.
note: These paths form a cycle:
╭──▶ ./visualization (src/resolution/visualization.ts)
│ ⬇ imports
│ ../builder/ConfigBuilder (src/builder/ConfigBuilder.ts)
│ ⬇ imports
│ ../resolution (src/resolution/index.ts)
╰─────────╯ imports the current file
x eslint(complexity): function `resolveExtends` has a complexity of 23. Maximum allowed is 20.
,-[src/resolver/builder.ts:51:8]
50 | */
51 | ,-> export function resolveExtends(
52 | | jobs: Record<string, JobDefinitionNormalized>,
53 | | templates: Record<string, JobDefinitionNormalized>,
54 | | jobOptionsMap: Record<string, JobOptions>,
55 | | globalOptions: GlobalOptions
56 | | ): {
57 | | resolved: Record<string, JobDefinitionOutput>
58 | | errors: ValidationError[]
59 | | warnings: ValidationError[]
60 | | skippedChecks: string[]
61 | | } {
62 | | const context: ResolutionContext = {
63 | | jobOptions: jobOptionsMap,
64 | | globalOptions,
65 | | errors: [],
66 | | warnings: [],
67 | | skippedChecks: [],
68 | | }
69 | |
70 | | // Build combined graph
71 | | const graph = buildExtendsGraph(jobs, templates, jobOptionsMap)
72 | |
73 | | // Validate graph
74 | | const validation = validateExtendsGraph(graph, globalOptions)
75 | | context.errors.push(...validation.errors)
76 | | context.warnings.push(...validation.warnings)
77 | | context.skippedChecks.push(...validation.skippedChecks)
78 | |
79 | | // If there are errors, return early
80 | | if (context.errors.length > 0) {
81 | | return {
82 | | resolved: {},
83 | | errors: context.errors,
84 | | warnings: context.warnings,
85 | | skippedChecks: context.skippedChecks,
86 | | }
87 | | }
88 | |
89 | | // Topological sort to get correct merge order
90 | | const sortedNames = topologicalSort(graph)
91 | |
92 | | // Resolve extends in topological order
93 | | const resolved = new Map<string, JobDefinitionOutput>()
94 | | const fullyResolved = new Map<string, JobDefinitionNormalized>()
95 | |
96 | | for (const name of sortedNames) {
97 | | const node = graph.get(name)
98 | | if (!node) {
99 | | continue
100 | | }
101 | |
102 | | // Check if this job should have extends resolved
103 | | const jobOpts = context.jobOptions[name]
104 | | const mergeExtends = jobOpts?.mergeExtends ?? globalOptions.mergeExtends
105 | | const resolveTemplatesOnly =
106 | | jobOpts?.resolveTemplatesOnly ?? globalOptions.resolveTemplatesOnly
107 | | const { mergeRemoteExtends } = globalOptions
108 | |
109 | | // Start with empty definition
110 | | let mergedDef: JobDefinitionNormalized = {}
111 | |
112 | | // Collect all extends that should be kept (not merged)
113 | | const keptExtends: string[] = []
114 | |
115 | | // Recursively collect non-template extends from merged templates
116 | | const collectNonTemplateExtends = (
117 | | extendName: string,
118 | | visited = new Set<string>()
119 | | ): void => {
120 | | if (visited.has(extendName)) {
121 | | return
122 | | }
123 | | visited.add(extendName)
124 | |
125 | | const targetName = graph.has(extendName) ? extendName : `.${extendName}`
126 | | const targetNode = graph.get(targetName)
127 | |
128 | | if (!targetNode?.extends) {
129 | | return
130 | | }
131 | |
132 | | for (const nestedExtend of targetNode.extends) {
133 | | const nestedTargetName = graph.has(nestedExtend)
134 | | ? nestedExtend
135 | | : `.${nestedExtend}`
136 | | const nestedNode = graph.get(nestedTargetName)
137 | |
138 | | if (!nestedNode) {
139 | | // Unknown extend, keep it
140 | | if (!keptExtends.includes(nestedExtend)) {
141 | | keptExtends.push(nestedExtend)
142 | | }
143 | | } else if (nestedNode.isRemote && !mergeRemoteExtends) {
144 | | // Remote extend when mergeRemoteExtends is false, keep it
145 | | if (!keptExtends.includes(nestedExtend)) {
146 | | keptExtends.push(nestedExtend)
147 | | }