@codacy/tools-detekt-1 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.
package/dist/index.js ADDED
@@ -0,0 +1,2819 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_tooling2 = require("@codacy/tooling");
37
+
38
+ // src/adapter.ts
39
+ var import_tooling = require("@codacy/tooling");
40
+ var import_fast_xml_parser = require("fast-xml-parser");
41
+ var import_path = __toESM(require("path"));
42
+ var import_promises = __toESM(require("fs/promises"));
43
+ var import_os = __toESM(require("os"));
44
+
45
+ // src/patterns.json
46
+ var patterns_default = [
47
+ {
48
+ id: "AbsentOrWrongFileLicense",
49
+ category: "BestPractice",
50
+ severityLevel: "Warning",
51
+ title: "Enforce Correct License Header",
52
+ enabled: false,
53
+ parameters: []
54
+ },
55
+ {
56
+ id: "AlsoCouldBeApply",
57
+ category: "CodeStyle",
58
+ severityLevel: "Info",
59
+ title: "Simplify also block to apply block",
60
+ enabled: false,
61
+ parameters: []
62
+ },
63
+ {
64
+ id: "AnnotationOnSeparateLine",
65
+ category: "CodeStyle",
66
+ severityLevel: "Info",
67
+ title: "Enforce Annotations on Separate Lines",
68
+ enabled: false,
69
+ parameters: []
70
+ },
71
+ {
72
+ id: "AnnotationSpacing",
73
+ category: "CodeStyle",
74
+ severityLevel: "Info",
75
+ title: "Disallow Empty Lines Between Annotations and Annotated Elements",
76
+ enabled: false,
77
+ parameters: []
78
+ },
79
+ {
80
+ id: "ArgumentListWrapping",
81
+ category: "CodeStyle",
82
+ severityLevel: "Info",
83
+ title: "Enforce Correct Argument List Wrapping",
84
+ enabled: false,
85
+ parameters: []
86
+ },
87
+ {
88
+ id: "ArrayPrimitive",
89
+ category: "Performance",
90
+ severityLevel: "Warning",
91
+ title: "Avoid Using Array<Primitive> to Prevent Boxing and Performance Hit",
92
+ enabled: false,
93
+ parameters: []
94
+ },
95
+ {
96
+ id: "AvoidReferentialEquality",
97
+ category: "ErrorProne",
98
+ severityLevel: "High",
99
+ title: "Avoid Using Referential Equality and Prefer Structural Equality Checks",
100
+ enabled: false,
101
+ parameters: []
102
+ },
103
+ {
104
+ id: "BlockCommentInitialStarAlignment",
105
+ category: "CodeStyle",
106
+ severityLevel: "Info",
107
+ title: "Enforce Alignment of Initial Star in Block Comments",
108
+ enabled: false,
109
+ parameters: []
110
+ },
111
+ {
112
+ id: "BooleanPropertyNaming",
113
+ category: "CodeStyle",
114
+ severityLevel: "Info",
115
+ title: "Enforce Boolean Property Naming Convention",
116
+ enabled: false,
117
+ parameters: []
118
+ },
119
+ {
120
+ id: "BracesOnIfStatements",
121
+ category: "CodeStyle",
122
+ severityLevel: "Info",
123
+ title: "Enforce Braces on If Statements According to Policy",
124
+ enabled: false,
125
+ parameters: []
126
+ },
127
+ {
128
+ id: "BracesOnWhenStatements",
129
+ category: "CodeStyle",
130
+ severityLevel: "Info",
131
+ title: "Enforce Braces Policy on When Statements",
132
+ enabled: false,
133
+ parameters: []
134
+ },
135
+ {
136
+ id: "CanBeNonNullable",
137
+ category: "BestPractice",
138
+ severityLevel: "Warning",
139
+ title: "Enforce Non-Nullable Variable Declaration",
140
+ enabled: false,
141
+ parameters: []
142
+ },
143
+ {
144
+ id: "CascadingCallWrapping",
145
+ category: "CodeStyle",
146
+ severityLevel: "Info",
147
+ title: "Enforce Consistent Cascading Call Wrapping",
148
+ enabled: false,
149
+ parameters: []
150
+ },
151
+ {
152
+ id: "CastNullableToNonNullableType",
153
+ category: "ErrorProne",
154
+ severityLevel: "High",
155
+ title: "Avoid Casting Nullable Type to Non-Nullable Type",
156
+ enabled: false,
157
+ parameters: []
158
+ },
159
+ {
160
+ id: "CastToNullableType",
161
+ category: "ErrorProne",
162
+ severityLevel: "High",
163
+ title: "Use safe cast instead of unsafe cast to nullable types",
164
+ enabled: false,
165
+ parameters: []
166
+ },
167
+ {
168
+ id: "ChainWrapping",
169
+ category: "CodeStyle",
170
+ severityLevel: "Info",
171
+ title: "Enforce Proper Chain Wrapping",
172
+ enabled: false,
173
+ parameters: []
174
+ },
175
+ {
176
+ id: "ClassName",
177
+ category: "CodeStyle",
178
+ severityLevel: "Info",
179
+ title: "Enforce Class or Object Name to Start with Uppercase Letter and Use Camel Case",
180
+ enabled: false,
181
+ parameters: []
182
+ },
183
+ {
184
+ id: "ClassNaming",
185
+ category: "CodeStyle",
186
+ severityLevel: "Info",
187
+ title: "Enforce Class and Object Naming Convention",
188
+ enabled: false,
189
+ parameters: []
190
+ },
191
+ {
192
+ id: "ClassOrdering",
193
+ category: "CodeStyle",
194
+ severityLevel: "Info",
195
+ title: "Enforce Class Member Ordering",
196
+ enabled: false,
197
+ parameters: []
198
+ },
199
+ {
200
+ id: "CognitiveComplexMethod",
201
+ category: "Complexity",
202
+ severityLevel: "Warning",
203
+ title: "Prefer splitting up complex methods into smaller, easier to understand methods",
204
+ enabled: false,
205
+ parameters: []
206
+ },
207
+ {
208
+ id: "CollapsibleIfStatements",
209
+ category: "Comprehensibility",
210
+ severityLevel: "Info",
211
+ title: "Collapse Nested If Statements",
212
+ enabled: false,
213
+ parameters: []
214
+ },
215
+ {
216
+ id: "CommentOverPrivateFunction",
217
+ category: "CodeStyle",
218
+ severityLevel: "Info",
219
+ title: "Avoid Comments for Private Functions",
220
+ enabled: true,
221
+ parameters: []
222
+ },
223
+ {
224
+ id: "CommentOverPrivateProperty",
225
+ category: "Comprehensibility",
226
+ severityLevel: "Info",
227
+ title: "Avoid Comments Over Private Properties by Using Self-Explanatory Names",
228
+ enabled: true,
229
+ parameters: []
230
+ },
231
+ {
232
+ id: "CommentSpacing",
233
+ category: "CodeStyle",
234
+ severityLevel: "Info",
235
+ title: "Enforce Proper Spacing Around Comments",
236
+ enabled: false,
237
+ parameters: []
238
+ },
239
+ {
240
+ id: "CommentWrapping",
241
+ category: "CodeStyle",
242
+ severityLevel: "Info",
243
+ title: "Enforce Block Comment Wrapping",
244
+ enabled: false,
245
+ parameters: []
246
+ },
247
+ {
248
+ id: "ComplexCondition",
249
+ category: "Complexity",
250
+ severityLevel: "Info",
251
+ title: "Simplify Complex Conditions",
252
+ enabled: true,
253
+ parameters: []
254
+ },
255
+ {
256
+ id: "ComplexInterface",
257
+ category: "Complexity",
258
+ severityLevel: "Warning",
259
+ title: "Avoid Complex Interfaces",
260
+ enabled: false,
261
+ parameters: []
262
+ },
263
+ {
264
+ id: "ConstructorParameterNaming",
265
+ category: "CodeStyle",
266
+ severityLevel: "Info",
267
+ title: "Enforce Constructor Parameter Naming Convention",
268
+ enabled: false,
269
+ parameters: []
270
+ },
271
+ {
272
+ id: "ContextReceiverMapping",
273
+ category: "CodeStyle",
274
+ severityLevel: "Info",
275
+ title: "Enforce Context Receiver Wrapping",
276
+ enabled: false,
277
+ parameters: []
278
+ },
279
+ {
280
+ id: "CouldBeSequence",
281
+ category: "Performance",
282
+ severityLevel: "Warning",
283
+ title: "Use Sequence for Chained Collection Operations",
284
+ enabled: false,
285
+ parameters: []
286
+ },
287
+ {
288
+ id: "CyclomaticComplexMethod",
289
+ category: "Complexity",
290
+ severityLevel: "Warning",
291
+ title: "Prefer splitting up complex methods into smaller, easier to test methods",
292
+ enabled: false,
293
+ parameters: []
294
+ },
295
+ {
296
+ id: "DataClassContainsFunctions",
297
+ category: "BestPractice",
298
+ severityLevel: "Warning",
299
+ title: "Avoid Extra Functions in Data Classes",
300
+ enabled: false,
301
+ parameters: []
302
+ },
303
+ {
304
+ id: "DataClassShouldBeImmutable",
305
+ category: "BestPractice",
306
+ severityLevel: "Warning",
307
+ title: "Enforce Data Classes to Be Immutable",
308
+ enabled: false,
309
+ parameters: []
310
+ },
311
+ {
312
+ id: "DeprecatedBlockTag",
313
+ category: "Documentation",
314
+ severityLevel: "Info",
315
+ title: "Avoid Using Deprecated Block Tag in KDoc",
316
+ enabled: false,
317
+ parameters: []
318
+ },
319
+ {
320
+ id: "Deprecation",
321
+ category: "ErrorProne",
322
+ severityLevel: "High",
323
+ title: "Avoid Using Deprecated Elements",
324
+ enabled: false,
325
+ parameters: []
326
+ },
327
+ {
328
+ id: "DestructuringDeclarationWithTooManyEntries",
329
+ category: "Comprehensibility",
330
+ severityLevel: "Info",
331
+ title: "Avoid Too Many Entries in a Destructuring Declaration",
332
+ enabled: false,
333
+ parameters: []
334
+ },
335
+ {
336
+ id: "DiscouragedCommentLocation",
337
+ category: "Comprehensibility",
338
+ severityLevel: "Info",
339
+ title: "Detect Discouraged Comment Locations",
340
+ enabled: false,
341
+ parameters: []
342
+ },
343
+ {
344
+ id: "DontDowncastCollectionTypes",
345
+ category: "ErrorProne",
346
+ severityLevel: "High",
347
+ title: "Avoid Downcasting Immutable Collection Types",
348
+ enabled: false,
349
+ parameters: []
350
+ },
351
+ {
352
+ id: "DoubleMutabilityForCollection",
353
+ category: "BestPractice",
354
+ severityLevel: "Warning",
355
+ title: "Avoid Double Mutability for Collections",
356
+ enabled: false,
357
+ parameters: []
358
+ },
359
+ {
360
+ id: "DoubleNegativeLambda",
361
+ category: "CodeStyle",
362
+ severityLevel: "Info",
363
+ title: "Avoid Double Negative Lambda Expressions",
364
+ enabled: false,
365
+ parameters: []
366
+ },
367
+ {
368
+ id: "DuplicateCaseInWhenExpression",
369
+ category: "ErrorProne",
370
+ severityLevel: "Warning",
371
+ title: "Avoid Duplicate Case Statements in When Expression",
372
+ enabled: false,
373
+ parameters: []
374
+ },
375
+ {
376
+ id: "ElseCaseInsteadOfExhaustiveWhen",
377
+ category: "ErrorProne",
378
+ severityLevel: "High",
379
+ title: "Avoid Else Case in Exhaustive When Expression",
380
+ enabled: false,
381
+ parameters: []
382
+ },
383
+ {
384
+ id: "EmptyCatchBlock",
385
+ category: "ErrorProne",
386
+ severityLevel: "High",
387
+ title: "Avoid Empty Catch Blocks",
388
+ enabled: true,
389
+ parameters: []
390
+ },
391
+ {
392
+ id: "EmptyClassBlock",
393
+ category: "CodeStyle",
394
+ severityLevel: "Info",
395
+ title: "Avoid Empty Class Blocks",
396
+ enabled: true,
397
+ parameters: []
398
+ },
399
+ {
400
+ id: "EmptyDefaultConstructor",
401
+ category: "CodeStyle",
402
+ severityLevel: "Info",
403
+ title: "Remove Empty Default Constructor",
404
+ enabled: true,
405
+ parameters: []
406
+ },
407
+ {
408
+ id: "EmptyDoWhileBlock",
409
+ category: "CodeStyle",
410
+ severityLevel: "Info",
411
+ title: "Avoid Empty Do-While Blocks",
412
+ enabled: true,
413
+ parameters: []
414
+ },
415
+ {
416
+ id: "EmptyElseBlock",
417
+ category: "CodeStyle",
418
+ severityLevel: "Info",
419
+ title: "Remove Empty Else Block",
420
+ enabled: true,
421
+ parameters: []
422
+ },
423
+ {
424
+ id: "EmptyFinallyBlock",
425
+ category: "CodeStyle",
426
+ severityLevel: "Info",
427
+ title: "Avoid Empty Finally Blocks",
428
+ enabled: true,
429
+ parameters: []
430
+ },
431
+ {
432
+ id: "EmptyForBlock",
433
+ category: "CodeStyle",
434
+ severityLevel: "Info",
435
+ title: "Avoid Empty For Blocks",
436
+ enabled: true,
437
+ parameters: []
438
+ },
439
+ {
440
+ id: "EmptyFunctionBlock",
441
+ category: "CodeStyle",
442
+ severityLevel: "Info",
443
+ title: "Avoid Empty Function Blocks",
444
+ enabled: true,
445
+ parameters: []
446
+ },
447
+ {
448
+ id: "EmptyIfBlock",
449
+ category: "CodeStyle",
450
+ severityLevel: "Info",
451
+ title: "Avoid Empty If Blocks",
452
+ enabled: true,
453
+ parameters: []
454
+ },
455
+ {
456
+ id: "EmptyInitBlock",
457
+ category: "CodeStyle",
458
+ severityLevel: "Info",
459
+ title: "Remove Empty init Blocks",
460
+ enabled: true,
461
+ parameters: []
462
+ },
463
+ {
464
+ id: "EmptyKtFile",
465
+ category: "CodeStyle",
466
+ severityLevel: "Info",
467
+ title: "Remove Empty Kotlin Files",
468
+ enabled: false,
469
+ parameters: []
470
+ },
471
+ {
472
+ id: "EmptySecondaryConstructor",
473
+ category: "CodeStyle",
474
+ severityLevel: "Info",
475
+ title: "Remove Empty Secondary Constructors",
476
+ enabled: true,
477
+ parameters: []
478
+ },
479
+ {
480
+ id: "EmptyTryBlock",
481
+ category: "CodeStyle",
482
+ severityLevel: "Info",
483
+ title: "Remove Empty Try Block",
484
+ enabled: false,
485
+ parameters: []
486
+ },
487
+ {
488
+ id: "EmptyWhenBlock",
489
+ category: "CodeStyle",
490
+ severityLevel: "Info",
491
+ title: "Avoid Empty When Blocks",
492
+ enabled: true,
493
+ parameters: []
494
+ },
495
+ {
496
+ id: "EmptyWhileBlock",
497
+ category: "CodeStyle",
498
+ severityLevel: "Info",
499
+ title: "Remove Empty While Blocks",
500
+ enabled: true,
501
+ parameters: []
502
+ },
503
+ {
504
+ id: "EndOfSentenceFormat",
505
+ category: "Documentation",
506
+ severityLevel: "Info",
507
+ title: "Enforce Proper End of First Sentence in KDoc Comments",
508
+ enabled: false,
509
+ parameters: []
510
+ },
511
+ {
512
+ id: "EnumEntryNameCase",
513
+ category: "CodeStyle",
514
+ severityLevel: "Info",
515
+ title: "Enforce Enum Entry Name Case Convention",
516
+ enabled: false,
517
+ parameters: []
518
+ },
519
+ {
520
+ id: "EnumNaming",
521
+ category: "CodeStyle",
522
+ severityLevel: "Info",
523
+ title: "Enforce Enum Naming Convention",
524
+ enabled: false,
525
+ parameters: []
526
+ },
527
+ {
528
+ id: "EnumWrapping",
529
+ category: "CodeStyle",
530
+ severityLevel: "Info",
531
+ title: "Enforce Enum Wrapping Style",
532
+ enabled: false,
533
+ parameters: []
534
+ },
535
+ {
536
+ id: "EqualsAlwaysReturnsTrueOrFalse",
537
+ category: "ErrorProne",
538
+ severityLevel: "High",
539
+ title: "Avoid equals() Method That Always Returns True or False",
540
+ enabled: true,
541
+ parameters: []
542
+ },
543
+ {
544
+ id: "EqualsNullCall",
545
+ category: "CodeStyle",
546
+ severityLevel: "Info",
547
+ title: "Avoid Using equals() to Compare with Null",
548
+ enabled: false,
549
+ parameters: []
550
+ },
551
+ {
552
+ id: "EqualsOnSignatureLine",
553
+ category: "CodeStyle",
554
+ severityLevel: "Info",
555
+ title: "Enforce equals sign on the same line as expression style function signature",
556
+ enabled: false,
557
+ parameters: []
558
+ },
559
+ {
560
+ id: "EqualsWithHashCodeExist",
561
+ category: "ErrorProne",
562
+ severityLevel: "High",
563
+ title: "Enforce overriding hashCode when equals is overridden",
564
+ enabled: true,
565
+ parameters: []
566
+ },
567
+ {
568
+ id: "ExceptionRaisedInUnexpectedLocation",
569
+ category: "ErrorProne",
570
+ severityLevel: "High",
571
+ title: "Avoid Throwing Exceptions in Unexpected Methods",
572
+ enabled: false,
573
+ parameters: []
574
+ },
575
+ {
576
+ id: "ExitOutsideMain",
577
+ category: "BestPractice",
578
+ severityLevel: "Warning",
579
+ title: "Avoid Exiting Process Outside Main Function",
580
+ enabled: false,
581
+ parameters: []
582
+ },
583
+ {
584
+ id: "ExplicitCollectionElementAccessMethod",
585
+ category: "CodeStyle",
586
+ severityLevel: "Info",
587
+ title: "Prefer indexed access operator [] for map element access or insert",
588
+ enabled: false,
589
+ parameters: []
590
+ },
591
+ {
592
+ id: "ExplicitGarbageCollectionCall",
593
+ category: "BestPractice",
594
+ severityLevel: "Warning",
595
+ title: "Avoid Explicit Garbage Collection Calls",
596
+ enabled: true,
597
+ parameters: []
598
+ },
599
+ {
600
+ id: "ExplicitItLambdaParameter",
601
+ category: "CodeStyle",
602
+ severityLevel: "Info",
603
+ title: "Avoid Declaring Lambda Parameters as `it`",
604
+ enabled: false,
605
+ parameters: []
606
+ },
607
+ {
608
+ id: "ExpressionBodySyntax",
609
+ category: "CodeStyle",
610
+ severityLevel: "Info",
611
+ title: "Enforce Expression Body Syntax for Single-Return Functions",
612
+ enabled: false,
613
+ parameters: []
614
+ },
615
+ {
616
+ id: "Filename",
617
+ category: "CodeStyle",
618
+ severityLevel: "Info",
619
+ title: "Enforce Top Level Class Name Matches Filename",
620
+ enabled: false,
621
+ parameters: []
622
+ },
623
+ {
624
+ id: "FinalNewline",
625
+ category: "CodeStyle",
626
+ severityLevel: "Info",
627
+ title: "Enforce Final Newline",
628
+ enabled: false,
629
+ parameters: []
630
+ },
631
+ {
632
+ id: "ForbiddenAnnotation",
633
+ category: "CodeStyle",
634
+ severityLevel: "Info",
635
+ title: "Avoid Using Forbidden Annotations",
636
+ enabled: false,
637
+ parameters: []
638
+ },
639
+ {
640
+ id: "ForbiddenClassName",
641
+ category: "CodeStyle",
642
+ severityLevel: "Info",
643
+ title: "Avoid Forbidden Class Names",
644
+ enabled: false,
645
+ parameters: []
646
+ },
647
+ {
648
+ id: "ForbiddenComment",
649
+ category: "BestPractice",
650
+ severityLevel: "Warning",
651
+ title: "Flag Forbidden Comments",
652
+ enabled: false,
653
+ parameters: []
654
+ },
655
+ {
656
+ id: "ForbiddenImport",
657
+ category: "BestPractice",
658
+ severityLevel: "Warning",
659
+ title: "Mark Forbidden Imports",
660
+ enabled: false,
661
+ parameters: []
662
+ },
663
+ {
664
+ id: "ForbiddenMethodCall",
665
+ category: "BestPractice",
666
+ severityLevel: "Warning",
667
+ title: "Mark Forbidden Method Calls",
668
+ enabled: false,
669
+ parameters: []
670
+ },
671
+ {
672
+ id: "ForbiddenPublicDataClass",
673
+ category: "Compatibility",
674
+ severityLevel: "High",
675
+ title: "Avoid Public Data Classes",
676
+ enabled: false,
677
+ parameters: []
678
+ },
679
+ {
680
+ id: "ForbiddenSuppress",
681
+ category: "BestPractice",
682
+ severityLevel: "Warning",
683
+ title: "Disallow Suppressing Forbidden Rules",
684
+ enabled: false,
685
+ parameters: []
686
+ },
687
+ {
688
+ id: "ForbiddenVoid",
689
+ category: "CodeStyle",
690
+ severityLevel: "Info",
691
+ title: "Use Unit Instead of Void",
692
+ enabled: false,
693
+ parameters: []
694
+ },
695
+ {
696
+ id: "ForEachOnRange",
697
+ category: "Performance",
698
+ severityLevel: "Warning",
699
+ title: "Avoid Using forEach on Ranges",
700
+ enabled: true,
701
+ parameters: []
702
+ },
703
+ {
704
+ id: "FunctionMaxLength",
705
+ category: "CodeStyle",
706
+ severityLevel: "Info",
707
+ title: "Enforce Maximum Function Name Length",
708
+ enabled: false,
709
+ parameters: []
710
+ },
711
+ {
712
+ id: "FunctionMinLength",
713
+ category: "CodeStyle",
714
+ severityLevel: "Info",
715
+ title: "Enforce Minimum Function Name Length",
716
+ enabled: false,
717
+ parameters: []
718
+ },
719
+ {
720
+ id: "FunctionName",
721
+ category: "CodeStyle",
722
+ severityLevel: "Info",
723
+ title: "Enforce function names to start with a lowercase letter and use camel case",
724
+ enabled: false,
725
+ parameters: []
726
+ },
727
+ {
728
+ id: "FunctionNaming",
729
+ category: "CodeStyle",
730
+ severityLevel: "Info",
731
+ title: "Enforce Function Naming Convention",
732
+ enabled: false,
733
+ parameters: []
734
+ },
735
+ {
736
+ id: "FunctionOnlyReturningConstant",
737
+ category: "CodeStyle",
738
+ severityLevel: "Info",
739
+ title: "Avoid Functions That Only Return a Constant",
740
+ enabled: false,
741
+ parameters: []
742
+ },
743
+ {
744
+ id: "FunctionParameterNaming",
745
+ category: "CodeStyle",
746
+ severityLevel: "Info",
747
+ title: "Enforce Function Parameter Naming Convention",
748
+ enabled: false,
749
+ parameters: []
750
+ },
751
+ {
752
+ id: "FunctionReturnTypeSpacing",
753
+ category: "CodeStyle",
754
+ severityLevel: "Info",
755
+ title: "Enforce Consistent Spacing Around Function Return Type",
756
+ enabled: false,
757
+ parameters: []
758
+ },
759
+ {
760
+ id: "FunctionSignature",
761
+ category: "CodeStyle",
762
+ severityLevel: "Info",
763
+ title: "Enforce function signature formatting",
764
+ enabled: false,
765
+ parameters: []
766
+ },
767
+ {
768
+ id: "FunctionStartOfBodySpacing",
769
+ category: "CodeStyle",
770
+ severityLevel: "Info",
771
+ title: "Enforce consistent spacing before start of function body",
772
+ enabled: false,
773
+ parameters: []
774
+ },
775
+ {
776
+ id: "FunctionTypeReferenceSpacing",
777
+ category: "CodeStyle",
778
+ severityLevel: "Info",
779
+ title: "Enforce Consistent Spacing in Function Type References",
780
+ enabled: false,
781
+ parameters: []
782
+ },
783
+ {
784
+ id: "FunKeywordSpacing",
785
+ category: "CodeStyle",
786
+ severityLevel: "Info",
787
+ title: "Enforce Consistent Spacing After 'fun' Keyword",
788
+ enabled: false,
789
+ parameters: []
790
+ },
791
+ {
792
+ id: "GlobalCoroutineUsage",
793
+ category: "BestPractice",
794
+ severityLevel: "Warning",
795
+ title: "Avoid Using GlobalScope for Coroutines",
796
+ enabled: false,
797
+ parameters: []
798
+ },
799
+ {
800
+ id: "HasPlatformType",
801
+ category: "ErrorProne",
802
+ severityLevel: "High",
803
+ title: "Declare Platform Types Explicitly in Public APIs",
804
+ enabled: false,
805
+ parameters: []
806
+ },
807
+ {
808
+ id: "IfElseBracing",
809
+ category: "CodeStyle",
810
+ severityLevel: "Info",
811
+ title: "Enforce Consistent Curly Braces in If-Else Branches",
812
+ enabled: false,
813
+ parameters: []
814
+ },
815
+ {
816
+ id: "IfElseWrapping",
817
+ category: "CodeStyle",
818
+ severityLevel: "Info",
819
+ title: "Enforce Single Else-Branch in Single Line If-Statements",
820
+ enabled: false,
821
+ parameters: []
822
+ },
823
+ {
824
+ id: "IgnoredReturnValue",
825
+ category: "ErrorProne",
826
+ severityLevel: "High",
827
+ title: "Avoid Ignoring Return Values of Annotated Functions",
828
+ enabled: false,
829
+ parameters: []
830
+ },
831
+ {
832
+ id: "ImplicitDefaultLocale",
833
+ category: "ErrorProne",
834
+ severityLevel: "High",
835
+ title: "Avoid Implicit Default Locale for String Processing",
836
+ enabled: false,
837
+ parameters: []
838
+ },
839
+ {
840
+ id: "ImplicitUnitReturnType",
841
+ category: "ErrorProne",
842
+ severityLevel: "Warning",
843
+ title: "Avoid Implicit Unit Return Type in Functions",
844
+ enabled: false,
845
+ parameters: []
846
+ },
847
+ {
848
+ id: "ImportOrdering",
849
+ category: "CodeStyle",
850
+ severityLevel: "Info",
851
+ title: "Enforce Import Ordering",
852
+ enabled: false,
853
+ parameters: []
854
+ },
855
+ {
856
+ id: "Indentation",
857
+ category: "CodeStyle",
858
+ severityLevel: "Info",
859
+ title: "Enforce Proper Indentation",
860
+ enabled: false,
861
+ parameters: []
862
+ },
863
+ {
864
+ id: "InjectDispatcher",
865
+ category: "BestPractice",
866
+ severityLevel: "Warning",
867
+ title: "Avoid Hardcoding Dispatchers in Coroutines; Use Dependency Injection",
868
+ enabled: false,
869
+ parameters: []
870
+ },
871
+ {
872
+ id: "InstanceOfCheckForException",
873
+ category: "BestPractice",
874
+ severityLevel: "Warning",
875
+ title: "Avoid Checking Exception Type Inside Catch Blocks",
876
+ enabled: false,
877
+ parameters: []
878
+ },
879
+ {
880
+ id: "InvalidPackageDeclaration",
881
+ category: "CodeStyle",
882
+ severityLevel: "Info",
883
+ title: "Enforce Kotlin Source Files Location Matches Package Declaration",
884
+ enabled: false,
885
+ parameters: []
886
+ },
887
+ {
888
+ id: "InvalidRange",
889
+ category: "ErrorProne",
890
+ severityLevel: "High",
891
+ title: "Avoid Invalid Ranges in Loops",
892
+ enabled: false,
893
+ parameters: []
894
+ },
895
+ {
896
+ id: "IteratorHasNextCallsNextMethod",
897
+ category: "ErrorProne",
898
+ severityLevel: "High",
899
+ title: "Avoid Calling next() Inside hasNext() Method",
900
+ enabled: false,
901
+ parameters: []
902
+ },
903
+ {
904
+ id: "IteratorNotThrowingNoSuchElementException",
905
+ category: "ErrorProne",
906
+ severityLevel: "High",
907
+ title: "Enforce Iterator.next() Throws NoSuchElementException When No More Elements",
908
+ enabled: true,
909
+ parameters: []
910
+ },
911
+ {
912
+ id: "KDocReferencesNonPublicProperty",
913
+ category: "Documentation",
914
+ severityLevel: "Info",
915
+ title: "Disallow KDoc References to Non-Public Properties",
916
+ enabled: false,
917
+ parameters: []
918
+ },
919
+ {
920
+ id: "KdocWrapping",
921
+ category: "CodeStyle",
922
+ severityLevel: "Info",
923
+ title: "Enforce KDoc Comment Wrapping",
924
+ enabled: false,
925
+ parameters: []
926
+ },
927
+ {
928
+ id: "LabeledExpression",
929
+ category: "Complexity",
930
+ severityLevel: "Warning",
931
+ title: "Avoid Labeled Expressions",
932
+ enabled: true,
933
+ parameters: []
934
+ },
935
+ {
936
+ id: "LambdaParameterNaming",
937
+ category: "CodeStyle",
938
+ severityLevel: "Info",
939
+ title: "Enforce Lambda Parameter Naming Convention",
940
+ enabled: false,
941
+ parameters: []
942
+ },
943
+ {
944
+ id: "LargeClass",
945
+ category: "Complexity",
946
+ severityLevel: "Warning",
947
+ title: "Enforce Single Responsibility by Avoiding Large Classes",
948
+ enabled: true,
949
+ parameters: []
950
+ },
951
+ {
952
+ id: "LateinitUsage",
953
+ category: "BestPractice",
954
+ severityLevel: "Warning",
955
+ title: "Avoid Usage of lateinit Modifier",
956
+ enabled: false,
957
+ parameters: []
958
+ },
959
+ {
960
+ id: "LibraryCodeMustSpecifyReturnType",
961
+ category: "BestPractice",
962
+ severityLevel: "Warning",
963
+ title: "Enforce Explicit Return Types on Library Functions and Properties",
964
+ enabled: false,
965
+ parameters: []
966
+ },
967
+ {
968
+ id: "LibraryEntitiesShouldNotBePublic",
969
+ category: "BestPractice",
970
+ severityLevel: "Warning",
971
+ title: "Avoid Public Library Classes",
972
+ enabled: false,
973
+ parameters: []
974
+ },
975
+ {
976
+ id: "LongMethod",
977
+ category: "Complexity",
978
+ severityLevel: "Warning",
979
+ title: "Avoid Long Methods",
980
+ enabled: true,
981
+ parameters: []
982
+ },
983
+ {
984
+ id: "LongParameterList",
985
+ category: "Complexity",
986
+ severityLevel: "Warning",
987
+ title: "Avoid Long Parameter Lists",
988
+ enabled: true,
989
+ parameters: []
990
+ },
991
+ {
992
+ id: "LoopWithTooManyJumpStatements",
993
+ category: "Comprehensibility",
994
+ severityLevel: "Info",
995
+ title: "Avoid loops with more than one break or continue statement",
996
+ enabled: false,
997
+ parameters: []
998
+ },
999
+ {
1000
+ id: "MagicNumber",
1001
+ category: "CodeStyle",
1002
+ severityLevel: "Info",
1003
+ title: "Avoid Magic Numbers",
1004
+ enabled: false,
1005
+ parameters: []
1006
+ },
1007
+ {
1008
+ id: "MandatoryBracesLoops",
1009
+ category: "CodeStyle",
1010
+ severityLevel: "Info",
1011
+ title: "Enforce Mandatory Braces for Multi-line Loops",
1012
+ enabled: false,
1013
+ parameters: []
1014
+ },
1015
+ {
1016
+ id: "MapGetWithNotNullAssertionOperator",
1017
+ category: "ErrorProne",
1018
+ severityLevel: "High",
1019
+ title: "Avoid map.get() with not-null assertion operator (!!)",
1020
+ enabled: false,
1021
+ parameters: []
1022
+ },
1023
+ {
1024
+ id: "MatchingDeclarationName",
1025
+ category: "CodeStyle",
1026
+ severityLevel: "Info",
1027
+ title: "Enforce Matching Declaration Name for Kotlin Files",
1028
+ enabled: false,
1029
+ parameters: []
1030
+ },
1031
+ {
1032
+ id: "MaxChainedCallsOnSameLine",
1033
+ category: "CodeStyle",
1034
+ severityLevel: "Info",
1035
+ title: "Enforce Maximum Number of Chained Calls on the Same Line",
1036
+ enabled: false,
1037
+ parameters: []
1038
+ },
1039
+ {
1040
+ id: "MaximumLineLength",
1041
+ category: "CodeStyle",
1042
+ severityLevel: "Info",
1043
+ title: "Enforce Maximum Line Length",
1044
+ enabled: false,
1045
+ parameters: []
1046
+ },
1047
+ {
1048
+ id: "MaxLineLength",
1049
+ category: "CodeStyle",
1050
+ severityLevel: "Info",
1051
+ title: "Enforce Maximum Line Length",
1052
+ enabled: false,
1053
+ parameters: []
1054
+ },
1055
+ {
1056
+ id: "MayBeConst",
1057
+ category: "Performance",
1058
+ severityLevel: "Warning",
1059
+ title: "Enforce usage of const val for compile-time constants",
1060
+ enabled: false,
1061
+ parameters: []
1062
+ },
1063
+ {
1064
+ id: "MemberNameEqualsClassName",
1065
+ category: "BestPractice",
1066
+ severityLevel: "Warning",
1067
+ title: "Avoid Member Name Equal to Parent Class or Object Name",
1068
+ enabled: false,
1069
+ parameters: []
1070
+ },
1071
+ {
1072
+ id: "MethodOverloading",
1073
+ category: "Complexity",
1074
+ severityLevel: "Warning",
1075
+ title: "Avoid Excessive Method Overloading",
1076
+ enabled: false,
1077
+ parameters: []
1078
+ },
1079
+ {
1080
+ id: "MissingPackageDeclaration",
1081
+ category: "BestPractice",
1082
+ severityLevel: "Warning",
1083
+ title: "Enforce Package Declaration in Kotlin Source Files",
1084
+ enabled: false,
1085
+ parameters: []
1086
+ },
1087
+ {
1088
+ id: "MissingWhenCase",
1089
+ category: "ErrorProne",
1090
+ severityLevel: "High",
1091
+ title: "Enforce Exhaustive When Cases for Enum or Sealed Classes",
1092
+ enabled: false,
1093
+ parameters: []
1094
+ },
1095
+ {
1096
+ id: "ModifierListSpacing",
1097
+ category: "CodeStyle",
1098
+ severityLevel: "Info",
1099
+ title: "Enforce Consistent Spacing Between Modifiers",
1100
+ enabled: false,
1101
+ parameters: []
1102
+ },
1103
+ {
1104
+ id: "ModifierOrder",
1105
+ category: "CodeStyle",
1106
+ severityLevel: "Info",
1107
+ title: "Enforce Correct Modifier Order",
1108
+ enabled: false,
1109
+ parameters: []
1110
+ },
1111
+ {
1112
+ id: "ModifierOrdering",
1113
+ category: "CodeStyle",
1114
+ severityLevel: "Info",
1115
+ title: "Enforce Modifier Ordering",
1116
+ enabled: false,
1117
+ parameters: []
1118
+ },
1119
+ {
1120
+ id: "MultilineExpressionWrapping",
1121
+ category: "CodeStyle",
1122
+ severityLevel: "Info",
1123
+ title: "Enforce multiline expression wrapping on the right hand side",
1124
+ enabled: false,
1125
+ parameters: []
1126
+ },
1127
+ {
1128
+ id: "MultiLineIfElse",
1129
+ category: "CodeStyle",
1130
+ severityLevel: "Info",
1131
+ title: "Enforce Braces on Multiline If-Else Statements",
1132
+ enabled: false,
1133
+ parameters: []
1134
+ },
1135
+ {
1136
+ id: "MultilineLambdaItParameter",
1137
+ category: "CodeStyle",
1138
+ severityLevel: "Info",
1139
+ title: "Avoid Using `it` as Parameter Name in Multiline Lambdas",
1140
+ enabled: false,
1141
+ parameters: []
1142
+ },
1143
+ {
1144
+ id: "MultilineRawStringIndentation",
1145
+ category: "CodeStyle",
1146
+ severityLevel: "Info",
1147
+ title: "Enforce Consistent Indentation of Multiline Raw Strings",
1148
+ enabled: false,
1149
+ parameters: []
1150
+ },
1151
+ {
1152
+ id: "NamedArguments",
1153
+ category: "Comprehensibility",
1154
+ severityLevel: "Info",
1155
+ title: "Enforce Named Arguments for Function Calls with Many Arguments",
1156
+ enabled: false,
1157
+ parameters: []
1158
+ },
1159
+ {
1160
+ id: "NestedBlockDepth",
1161
+ category: "Complexity",
1162
+ severityLevel: "Warning",
1163
+ title: "Avoid Excessive Nested Block Depth",
1164
+ enabled: true,
1165
+ parameters: []
1166
+ },
1167
+ {
1168
+ id: "NestedClassesVisibility",
1169
+ category: "CodeStyle",
1170
+ severityLevel: "Info",
1171
+ title: "Avoid explicit public modifier on nested classes inside internal classes",
1172
+ enabled: false,
1173
+ parameters: []
1174
+ },
1175
+ {
1176
+ id: "NestedScopeFunctions",
1177
+ category: "Complexity",
1178
+ severityLevel: "Warning",
1179
+ title: "Avoid Overusing Nested Scope Functions",
1180
+ enabled: false,
1181
+ parameters: []
1182
+ },
1183
+ {
1184
+ id: "NewLineAtEndOfFile",
1185
+ category: "CodeStyle",
1186
+ severityLevel: "Info",
1187
+ title: "Enforce Newline at End of File",
1188
+ enabled: false,
1189
+ parameters: []
1190
+ },
1191
+ {
1192
+ id: "NoBlankLineBeforeRbrace",
1193
+ category: "CodeStyle",
1194
+ severityLevel: "Info",
1195
+ title: "Disallow Blank Lines Before Closing Braces",
1196
+ enabled: false,
1197
+ parameters: []
1198
+ },
1199
+ {
1200
+ id: "NoBlankLineInList",
1201
+ category: "CodeStyle",
1202
+ severityLevel: "Info",
1203
+ title: "Disallow Blank Lines in Lists",
1204
+ enabled: false,
1205
+ parameters: []
1206
+ },
1207
+ {
1208
+ id: "NoBlankLinesInChainedMethodCalls",
1209
+ category: "CodeStyle",
1210
+ severityLevel: "Info",
1211
+ title: "Disallow Blank Lines in Chained Method Calls",
1212
+ enabled: false,
1213
+ parameters: []
1214
+ },
1215
+ {
1216
+ id: "NoConsecutiveBlankLines",
1217
+ category: "CodeStyle",
1218
+ severityLevel: "Info",
1219
+ title: "Avoid Consecutive Blank Lines",
1220
+ enabled: false,
1221
+ parameters: []
1222
+ },
1223
+ {
1224
+ id: "NoConsecutiveComments",
1225
+ category: "CodeStyle",
1226
+ severityLevel: "Info",
1227
+ title: "Disallow Consecutive Comments",
1228
+ enabled: false,
1229
+ parameters: []
1230
+ },
1231
+ {
1232
+ id: "NoEmptyClassBody",
1233
+ category: "CodeStyle",
1234
+ severityLevel: "Info",
1235
+ title: "Avoid Empty Class Bodies",
1236
+ enabled: false,
1237
+ parameters: []
1238
+ },
1239
+ {
1240
+ id: "NoEmptyFirstLineInClassBody",
1241
+ category: "CodeStyle",
1242
+ severityLevel: "Info",
1243
+ title: "Disallow blank lines at start of class body",
1244
+ enabled: false,
1245
+ parameters: []
1246
+ },
1247
+ {
1248
+ id: "NoEmptyFirstLineInMethodBlock",
1249
+ category: "CodeStyle",
1250
+ severityLevel: "Info",
1251
+ title: "Disallow Empty First Line in Method Block",
1252
+ enabled: false,
1253
+ parameters: []
1254
+ },
1255
+ {
1256
+ id: "NoLineBreakAfterElse",
1257
+ category: "CodeStyle",
1258
+ severityLevel: "Info",
1259
+ title: "Disallow Line Breaks After Else",
1260
+ enabled: false,
1261
+ parameters: []
1262
+ },
1263
+ {
1264
+ id: "NoLineBreakBeforeAssignment",
1265
+ category: "CodeStyle",
1266
+ severityLevel: "Info",
1267
+ title: "Avoid Line Breaks Before Assignment Operator",
1268
+ enabled: false,
1269
+ parameters: []
1270
+ },
1271
+ {
1272
+ id: "NoMultipleSpaces",
1273
+ category: "CodeStyle",
1274
+ severityLevel: "Info",
1275
+ title: "Disallow Multiple Consecutive Spaces",
1276
+ enabled: false,
1277
+ parameters: []
1278
+ },
1279
+ {
1280
+ id: "NoNameShadowing",
1281
+ category: "BestPractice",
1282
+ severityLevel: "Warning",
1283
+ title: "Disallow Shadowing Variable Declarations",
1284
+ enabled: false,
1285
+ parameters: []
1286
+ },
1287
+ {
1288
+ id: "NonBooleanPropertyPrefixedWithIs",
1289
+ category: "CodeStyle",
1290
+ severityLevel: "Info",
1291
+ title: "Enforce Boolean Property Names Starting with 'is' Prefix",
1292
+ enabled: false,
1293
+ parameters: []
1294
+ },
1295
+ {
1296
+ id: "NoSemicolons",
1297
+ category: "CodeStyle",
1298
+ severityLevel: "Info",
1299
+ title: "Disallow Unnecessary Semicolons",
1300
+ enabled: false,
1301
+ parameters: []
1302
+ },
1303
+ {
1304
+ id: "NoSingleLineBlockComment",
1305
+ category: "CodeStyle",
1306
+ severityLevel: "Info",
1307
+ title: "Avoid Single Line Block Comments",
1308
+ enabled: false,
1309
+ parameters: []
1310
+ },
1311
+ {
1312
+ id: "NoTabs",
1313
+ category: "CodeStyle",
1314
+ severityLevel: "Info",
1315
+ title: "Disallow Tabs in Kotlin Source Files",
1316
+ enabled: false,
1317
+ parameters: []
1318
+ },
1319
+ {
1320
+ id: "NotImplementedDeclaration",
1321
+ category: "ErrorProne",
1322
+ severityLevel: "High",
1323
+ title: "Avoid NotImplementedDeclaration in Production Code",
1324
+ enabled: false,
1325
+ parameters: []
1326
+ },
1327
+ {
1328
+ id: "NoTrailingSpaces",
1329
+ category: "CodeStyle",
1330
+ severityLevel: "Info",
1331
+ title: "Avoid Trailing Spaces",
1332
+ enabled: false,
1333
+ parameters: []
1334
+ },
1335
+ {
1336
+ id: "NoUnitReturn",
1337
+ category: "CodeStyle",
1338
+ severityLevel: "Info",
1339
+ title: "Avoid Optional 'Unit' Return Types",
1340
+ enabled: false,
1341
+ parameters: []
1342
+ },
1343
+ {
1344
+ id: "NoUnusedImports",
1345
+ category: "UnusedCode",
1346
+ severityLevel: "Info",
1347
+ title: "Detect Unused Imports",
1348
+ enabled: false,
1349
+ parameters: []
1350
+ },
1351
+ {
1352
+ id: "NoWildcardImports",
1353
+ category: "CodeStyle",
1354
+ severityLevel: "Info",
1355
+ title: "Avoid Wildcard Imports",
1356
+ enabled: false,
1357
+ parameters: []
1358
+ },
1359
+ {
1360
+ id: "NullableBooleanCheck",
1361
+ category: "CodeStyle",
1362
+ severityLevel: "Info",
1363
+ title: "Enforce Nullable Boolean Check Using Equality Operators",
1364
+ enabled: false,
1365
+ parameters: []
1366
+ },
1367
+ {
1368
+ id: "NullableToStringCall",
1369
+ category: "ErrorProne",
1370
+ severityLevel: "High",
1371
+ title: "Avoid toString() on Nullable Receiver",
1372
+ enabled: false,
1373
+ parameters: []
1374
+ },
1375
+ {
1376
+ id: "NullableTypeSpacing",
1377
+ category: "CodeStyle",
1378
+ severityLevel: "Info",
1379
+ title: "EnforceNoSpacesInNullableType",
1380
+ enabled: false,
1381
+ parameters: []
1382
+ },
1383
+ {
1384
+ id: "NullCheckOnMutableProperty",
1385
+ category: "ErrorProne",
1386
+ severityLevel: "High",
1387
+ title: "Avoid Null Check on Mutable Property",
1388
+ enabled: false,
1389
+ parameters: []
1390
+ },
1391
+ {
1392
+ id: "ObjectExtendsThrowable",
1393
+ category: "ErrorProne",
1394
+ severityLevel: "High",
1395
+ title: "Avoid Object Extending Throwable",
1396
+ enabled: false,
1397
+ parameters: []
1398
+ },
1399
+ {
1400
+ id: "ObjectLiteralToLambda",
1401
+ category: "CodeStyle",
1402
+ severityLevel: "Info",
1403
+ title: "Convert Object Literals to Lambdas",
1404
+ enabled: false,
1405
+ parameters: []
1406
+ },
1407
+ {
1408
+ id: "ObjectPropertyNaming",
1409
+ category: "CodeStyle",
1410
+ severityLevel: "Info",
1411
+ title: "Enforce Object Property Naming Convention",
1412
+ enabled: false,
1413
+ parameters: []
1414
+ },
1415
+ {
1416
+ id: "OptionalAbstractKeyword",
1417
+ category: "CodeStyle",
1418
+ severityLevel: "Info",
1419
+ title: "Remove Unnecessary Abstract Modifier in Interface",
1420
+ enabled: false,
1421
+ parameters: []
1422
+ },
1423
+ {
1424
+ id: "OptionalUnit",
1425
+ category: "CodeStyle",
1426
+ severityLevel: "Info",
1427
+ title: "Avoid Unnecessary Return Type Unit",
1428
+ enabled: false,
1429
+ parameters: []
1430
+ },
1431
+ {
1432
+ id: "OptionalWhenBraces",
1433
+ category: "CodeStyle",
1434
+ severityLevel: "Info",
1435
+ title: "Remove Optional Braces in When Expressions",
1436
+ enabled: false,
1437
+ parameters: []
1438
+ },
1439
+ {
1440
+ id: "OutdatedDocumentation",
1441
+ category: "Documentation",
1442
+ severityLevel: "Info",
1443
+ title: "Enforce KDoc Comments Match Function or Class Signature",
1444
+ enabled: false,
1445
+ parameters: []
1446
+ },
1447
+ {
1448
+ id: "PackageName",
1449
+ category: "CodeStyle",
1450
+ severityLevel: "Info",
1451
+ title: "Enforce Package Name Formatting",
1452
+ enabled: false,
1453
+ parameters: []
1454
+ },
1455
+ {
1456
+ id: "PackageNaming",
1457
+ category: "CodeStyle",
1458
+ severityLevel: "Info",
1459
+ title: "Enforce Package Naming Convention",
1460
+ enabled: false,
1461
+ parameters: []
1462
+ },
1463
+ {
1464
+ id: "ParameterListSpacing",
1465
+ category: "CodeStyle",
1466
+ severityLevel: "Info",
1467
+ title: "Enforce Consistent Spacing Inside Parameter List",
1468
+ enabled: false,
1469
+ parameters: []
1470
+ },
1471
+ {
1472
+ id: "ParameterListWrapping",
1473
+ category: "CodeStyle",
1474
+ severityLevel: "Info",
1475
+ title: "Enforce Parameter List Wrapping",
1476
+ enabled: false,
1477
+ parameters: []
1478
+ },
1479
+ {
1480
+ id: "ParameterWrapping",
1481
+ category: "CodeStyle",
1482
+ severityLevel: "Info",
1483
+ title: "Enforce Parameter Wrapping for Long Function and Class Parameters",
1484
+ enabled: false,
1485
+ parameters: []
1486
+ },
1487
+ {
1488
+ id: "PreferToOverPairSyntax",
1489
+ category: "CodeStyle",
1490
+ severityLevel: "Info",
1491
+ title: "Prefer 'to' Syntax Over Pair Constructor",
1492
+ enabled: false,
1493
+ parameters: []
1494
+ },
1495
+ {
1496
+ id: "PrintStackTrace",
1497
+ category: "BestPractice",
1498
+ severityLevel: "Warning",
1499
+ title: "Avoid Printing Stack Trace Directly",
1500
+ enabled: false,
1501
+ parameters: []
1502
+ },
1503
+ {
1504
+ id: "PropertyName",
1505
+ category: "CodeStyle",
1506
+ severityLevel: "Info",
1507
+ title: "Enforce Property Naming Conventions",
1508
+ enabled: false,
1509
+ parameters: []
1510
+ },
1511
+ {
1512
+ id: "PropertyUsedBeforeDeclaration",
1513
+ category: "ErrorProne",
1514
+ severityLevel: "High",
1515
+ title: "Avoid Using Properties Before Declaration",
1516
+ enabled: false,
1517
+ parameters: []
1518
+ },
1519
+ {
1520
+ id: "PropertyWrapping",
1521
+ category: "CodeStyle",
1522
+ severityLevel: "Info",
1523
+ title: "Enforce Property Type or Value Wrapping",
1524
+ enabled: false,
1525
+ parameters: []
1526
+ },
1527
+ {
1528
+ id: "ProtectedMemberInFinalClass",
1529
+ category: "CodeStyle",
1530
+ severityLevel: "Info",
1531
+ title: "Avoid Protected Members in Final Classes",
1532
+ enabled: false,
1533
+ parameters: []
1534
+ },
1535
+ {
1536
+ id: "RedundantElseInWhen",
1537
+ category: "BestPractice",
1538
+ severityLevel: "Info",
1539
+ title: "Avoid Redundant else Case in when Expression",
1540
+ enabled: false,
1541
+ parameters: []
1542
+ },
1543
+ {
1544
+ id: "RedundantExplicitType",
1545
+ category: "CodeStyle",
1546
+ severityLevel: "Info",
1547
+ title: "Avoid Redundant Explicit Type Declaration",
1548
+ enabled: false,
1549
+ parameters: []
1550
+ },
1551
+ {
1552
+ id: "RedundantHigherOrderMapUsage",
1553
+ category: "CodeStyle",
1554
+ severityLevel: "Info",
1555
+ title: "Avoid Redundant 'map' Calls",
1556
+ enabled: false,
1557
+ parameters: []
1558
+ },
1559
+ {
1560
+ id: "RedundantSuspendModifier",
1561
+ category: "BestPractice",
1562
+ severityLevel: "Warning",
1563
+ title: "Avoid Redundant Suspend Modifier",
1564
+ enabled: false,
1565
+ parameters: []
1566
+ },
1567
+ {
1568
+ id: "RedundantVisibilityModifierRule",
1569
+ category: "CodeStyle",
1570
+ severityLevel: "Info",
1571
+ title: "Avoid Redundant Visibility Modifiers",
1572
+ enabled: false,
1573
+ parameters: []
1574
+ },
1575
+ {
1576
+ id: "ReplaceSafeCallChainWithRun",
1577
+ category: "Complexity",
1578
+ severityLevel: "Warning",
1579
+ title: "Replace Safe Call Chain with run Block",
1580
+ enabled: false,
1581
+ parameters: []
1582
+ },
1583
+ {
1584
+ id: "RethrowCaughtException",
1585
+ category: "BestPractice",
1586
+ severityLevel: "Warning",
1587
+ title: "Avoid Rethrowing Caught Exception of the Same Type",
1588
+ enabled: true,
1589
+ parameters: []
1590
+ },
1591
+ {
1592
+ id: "ReturnCount",
1593
+ category: "CodeStyle",
1594
+ severityLevel: "Info",
1595
+ title: "Restrict the Number of Return Statements in Methods",
1596
+ enabled: false,
1597
+ parameters: []
1598
+ },
1599
+ {
1600
+ id: "ReturnFromFinally",
1601
+ category: "ErrorProne",
1602
+ severityLevel: "High",
1603
+ title: "Avoid Return Statements Within Finally Blocks",
1604
+ enabled: true,
1605
+ parameters: []
1606
+ },
1607
+ {
1608
+ id: "SafeCast",
1609
+ category: "CodeStyle",
1610
+ severityLevel: "Info",
1611
+ title: "Prefer Safe Cast Instead of If-Else-Null",
1612
+ enabled: false,
1613
+ parameters: []
1614
+ },
1615
+ {
1616
+ id: "SerialVersionUIDInSerializableClass",
1617
+ category: "ErrorProne",
1618
+ severityLevel: "High",
1619
+ title: "Enforce Correct serialVersionUID in Serializable Classes",
1620
+ enabled: false,
1621
+ parameters: []
1622
+ },
1623
+ {
1624
+ id: "SleepInsteadOfDelay",
1625
+ category: "ErrorProne",
1626
+ severityLevel: "High",
1627
+ title: "Avoid Usage of Thread.sleep() in Coroutines",
1628
+ enabled: false,
1629
+ parameters: []
1630
+ },
1631
+ {
1632
+ id: "SpacingAroundAngleBrackets",
1633
+ category: "CodeStyle",
1634
+ severityLevel: "Info",
1635
+ title: "EnforceNoSpacesAroundAngleBrackets",
1636
+ enabled: false,
1637
+ parameters: []
1638
+ },
1639
+ {
1640
+ id: "SpacingAroundColon",
1641
+ category: "CodeStyle",
1642
+ severityLevel: "Info",
1643
+ title: "Enforce Consistent Spacing Around Colons",
1644
+ enabled: false,
1645
+ parameters: []
1646
+ },
1647
+ {
1648
+ id: "SpacingAroundComma",
1649
+ category: "CodeStyle",
1650
+ severityLevel: "Info",
1651
+ title: "Enforce Consistent Spacing Around Commas",
1652
+ enabled: false,
1653
+ parameters: []
1654
+ },
1655
+ {
1656
+ id: "SpacingAroundCurly",
1657
+ category: "CodeStyle",
1658
+ severityLevel: "Info",
1659
+ title: "Enforce Consistent Spacing Around Curly Braces",
1660
+ enabled: false,
1661
+ parameters: []
1662
+ },
1663
+ {
1664
+ id: "SpacingAroundDot",
1665
+ category: "CodeStyle",
1666
+ severityLevel: "Info",
1667
+ title: "Avoid Spaces Around Member Invocation Operator (Dot)",
1668
+ enabled: false,
1669
+ parameters: []
1670
+ },
1671
+ {
1672
+ id: "SpacingAroundDoubleColon",
1673
+ category: "CodeStyle",
1674
+ severityLevel: "Info",
1675
+ title: "Disallow Spaces Around Double Colon",
1676
+ enabled: false,
1677
+ parameters: []
1678
+ },
1679
+ {
1680
+ id: "SpacingAroundKeyword",
1681
+ category: "CodeStyle",
1682
+ severityLevel: "Info",
1683
+ title: "Enforce Consistent Spacing Around Keywords",
1684
+ enabled: false,
1685
+ parameters: []
1686
+ },
1687
+ {
1688
+ id: "SpacingAroundOperators",
1689
+ category: "CodeStyle",
1690
+ severityLevel: "Info",
1691
+ title: "Enforce Consistent Spacing Around Operators",
1692
+ enabled: false,
1693
+ parameters: []
1694
+ },
1695
+ {
1696
+ id: "SpacingAroundParens",
1697
+ category: "CodeStyle",
1698
+ severityLevel: "Info",
1699
+ title: "Avoid Spaces Around Parentheses",
1700
+ enabled: false,
1701
+ parameters: []
1702
+ },
1703
+ {
1704
+ id: "SpacingAroundRangeOperator",
1705
+ category: "CodeStyle",
1706
+ severityLevel: "Info",
1707
+ title: "Enforce Consistent Spacing Around Range Operator",
1708
+ enabled: false,
1709
+ parameters: []
1710
+ },
1711
+ {
1712
+ id: "SpacingAroundUnaryOperator",
1713
+ category: "CodeStyle",
1714
+ severityLevel: "Info",
1715
+ title: "Disallow Spaces Around Unary Operators",
1716
+ enabled: false,
1717
+ parameters: []
1718
+ },
1719
+ {
1720
+ id: "SpacingBetweenDeclarationsWithAnnotations",
1721
+ category: "CodeStyle",
1722
+ severityLevel: "Info",
1723
+ title: "Enforce Spacing Between Declarations With Annotations",
1724
+ enabled: false,
1725
+ parameters: []
1726
+ },
1727
+ {
1728
+ id: "SpacingBetweenDeclarationsWithComments",
1729
+ category: "CodeStyle",
1730
+ severityLevel: "Info",
1731
+ title: "Enforce spacing between declarations and declarations with comments",
1732
+ enabled: false,
1733
+ parameters: []
1734
+ },
1735
+ {
1736
+ id: "SpacingBetweenFunctionNameAndOpeningParenthesis",
1737
+ category: "CodeStyle",
1738
+ severityLevel: "Info",
1739
+ title: "Enforce consistent spacing between function name and opening parenthesis",
1740
+ enabled: false,
1741
+ parameters: []
1742
+ },
1743
+ {
1744
+ id: "SpacingBetweenPackageAndImports",
1745
+ category: "CodeStyle",
1746
+ severityLevel: "Info",
1747
+ title: "Enforce Spacing Between Package and Imports",
1748
+ enabled: false,
1749
+ parameters: []
1750
+ },
1751
+ {
1752
+ id: "SpreadOperator",
1753
+ category: "Performance",
1754
+ severityLevel: "Warning",
1755
+ title: "Avoid Using Spread Operator Causing Array Copy",
1756
+ enabled: true,
1757
+ parameters: []
1758
+ },
1759
+ {
1760
+ id: "StringLiteralDuplication",
1761
+ category: "Complexity",
1762
+ severityLevel: "Warning",
1763
+ title: "Avoid String Literal Duplication",
1764
+ enabled: true,
1765
+ parameters: []
1766
+ },
1767
+ {
1768
+ id: "StringShouldBeRawString",
1769
+ category: "CodeStyle",
1770
+ severityLevel: "Info",
1771
+ title: "Convert String to Raw String",
1772
+ enabled: false,
1773
+ parameters: []
1774
+ },
1775
+ {
1776
+ id: "StringTemplate",
1777
+ category: "CodeStyle",
1778
+ severityLevel: "Info",
1779
+ title: "Enforce Simplified String Templates",
1780
+ enabled: false,
1781
+ parameters: []
1782
+ },
1783
+ {
1784
+ id: "StringTemplateIndent",
1785
+ category: "CodeStyle",
1786
+ severityLevel: "Info",
1787
+ title: "Enforce Consistent Multiline String Template Indentation with trimIndent()",
1788
+ enabled: false,
1789
+ parameters: []
1790
+ },
1791
+ {
1792
+ id: "SuspendFunSwallowedCancellation",
1793
+ category: "ErrorProne",
1794
+ severityLevel: "Error",
1795
+ title: "Avoid Using runCatching with suspend Lambda Blocks",
1796
+ enabled: false,
1797
+ parameters: []
1798
+ },
1799
+ {
1800
+ id: "SuspendFunWithCoroutineScopeReceiver",
1801
+ category: "BestPractice",
1802
+ severityLevel: "Warning",
1803
+ title: "Avoid suspend modifier on functions with CoroutineScope receiver",
1804
+ enabled: false,
1805
+ parameters: []
1806
+ },
1807
+ {
1808
+ id: "SuspendFunWithFlowReturnType",
1809
+ category: "BestPractice",
1810
+ severityLevel: "Warning",
1811
+ title: "Avoid suspend modifier on functions returning Flow",
1812
+ enabled: false,
1813
+ parameters: []
1814
+ },
1815
+ {
1816
+ id: "SwallowedException",
1817
+ category: "ErrorProne",
1818
+ severityLevel: "High",
1819
+ title: "Avoid Swallowing Exceptions",
1820
+ enabled: false,
1821
+ parameters: []
1822
+ },
1823
+ {
1824
+ id: "ThrowingExceptionFromFinally",
1825
+ category: "ErrorProne",
1826
+ severityLevel: "High",
1827
+ title: "Avoid Throwing Exceptions From Finally Blocks",
1828
+ enabled: true,
1829
+ parameters: []
1830
+ },
1831
+ {
1832
+ id: "ThrowingExceptionInMain",
1833
+ category: "ErrorProne",
1834
+ severityLevel: "High",
1835
+ title: "Avoid Throwing Exceptions in Main Method",
1836
+ enabled: false,
1837
+ parameters: []
1838
+ },
1839
+ {
1840
+ id: "ThrowingExceptionsWithoutMessageOrCause",
1841
+ category: "BestPractice",
1842
+ severityLevel: "Warning",
1843
+ title: "Enforce Providing Message or Cause When Throwing Exceptions",
1844
+ enabled: false,
1845
+ parameters: []
1846
+ },
1847
+ {
1848
+ id: "ThrowingNewInstanceOfSameException",
1849
+ category: "BestPractice",
1850
+ severityLevel: "Warning",
1851
+ title: "Avoid Throwing New Instance of Same Exception",
1852
+ enabled: true,
1853
+ parameters: []
1854
+ },
1855
+ {
1856
+ id: "ThrowsCount",
1857
+ category: "CodeStyle",
1858
+ severityLevel: "Info",
1859
+ title: "Restrict the Number of Throw Statements in Methods",
1860
+ enabled: false,
1861
+ parameters: []
1862
+ },
1863
+ {
1864
+ id: "TooGenericExceptionCaught",
1865
+ category: "ErrorProne",
1866
+ severityLevel: "High",
1867
+ title: "Avoid Catching Too Generic Exceptions",
1868
+ enabled: true,
1869
+ parameters: []
1870
+ },
1871
+ {
1872
+ id: "TooGenericExceptionThrown",
1873
+ category: "ErrorProne",
1874
+ severityLevel: "High",
1875
+ title: "Avoid Throwing Too Generic Exceptions",
1876
+ enabled: true,
1877
+ parameters: []
1878
+ },
1879
+ {
1880
+ id: "TooManyFunctions",
1881
+ category: "Complexity",
1882
+ severityLevel: "Warning",
1883
+ title: "Avoid Too Many Functions in a File/Class/Object/Interface",
1884
+ enabled: true,
1885
+ parameters: []
1886
+ },
1887
+ {
1888
+ id: "TopLevelPropertyNaming",
1889
+ category: "CodeStyle",
1890
+ severityLevel: "Info",
1891
+ title: "Enforce Top Level Property Naming Convention",
1892
+ enabled: false,
1893
+ parameters: []
1894
+ },
1895
+ {
1896
+ id: "TrailingCommaOnCallSite",
1897
+ category: "CodeStyle",
1898
+ severityLevel: "Info",
1899
+ title: "Enforce Consistent Trailing Comma Usage at Call Sites",
1900
+ enabled: false,
1901
+ parameters: []
1902
+ },
1903
+ {
1904
+ id: "TrailingCommaOnDeclarationSite",
1905
+ category: "CodeStyle",
1906
+ severityLevel: "Info",
1907
+ title: "Enforce Consistent Trailing Commas at Declaration Sites",
1908
+ enabled: false,
1909
+ parameters: []
1910
+ },
1911
+ {
1912
+ id: "TrailingWhitespace",
1913
+ category: "CodeStyle",
1914
+ severityLevel: "Info",
1915
+ title: "Remove Trailing Whitespace",
1916
+ enabled: false,
1917
+ parameters: []
1918
+ },
1919
+ {
1920
+ id: "TrimMultilineRawString",
1921
+ category: "CodeStyle",
1922
+ severityLevel: "Info",
1923
+ title: "Enforce trimMargin() or trimIndent() on Multiline Raw Strings",
1924
+ enabled: false,
1925
+ parameters: []
1926
+ },
1927
+ {
1928
+ id: "TryCatchFinallySpacing",
1929
+ category: "CodeStyle",
1930
+ severityLevel: "Info",
1931
+ title: "Enforce Consistent Spacing in Try-Catch-Finally Blocks",
1932
+ enabled: false,
1933
+ parameters: []
1934
+ },
1935
+ {
1936
+ id: "TypeArgumentListSpacing",
1937
+ category: "CodeStyle",
1938
+ severityLevel: "Info",
1939
+ title: "EnforceNoSpacesInTypeArgumentList",
1940
+ enabled: false,
1941
+ parameters: []
1942
+ },
1943
+ {
1944
+ id: "TypeParameterListSpacing",
1945
+ category: "CodeStyle",
1946
+ severityLevel: "Info",
1947
+ title: "Enforce spacing after type parameter list in function and class declarations",
1948
+ enabled: false,
1949
+ parameters: []
1950
+ },
1951
+ {
1952
+ id: "UnconditionalJumpStatementInLoop",
1953
+ category: "CodeStyle",
1954
+ severityLevel: "Info",
1955
+ title: "Avoid Unconditional Jump Statements in Loops",
1956
+ enabled: false,
1957
+ parameters: []
1958
+ },
1959
+ {
1960
+ id: "UnderscoresInNumericLiterals",
1961
+ category: "CodeStyle",
1962
+ severityLevel: "Info",
1963
+ title: "Enforce Underscores in Numeric Literals for Readability",
1964
+ enabled: false,
1965
+ parameters: []
1966
+ },
1967
+ {
1968
+ id: "UndocumentedPublicClass",
1969
+ category: "Documentation",
1970
+ severityLevel: "Info",
1971
+ title: "Enforce Documentation for Public Classes, Interfaces, and Objects",
1972
+ enabled: true,
1973
+ parameters: []
1974
+ },
1975
+ {
1976
+ id: "UndocumentedPublicFunction",
1977
+ category: "Documentation",
1978
+ severityLevel: "Info",
1979
+ title: "Enforce Documentation on Public Functions",
1980
+ enabled: true,
1981
+ parameters: []
1982
+ },
1983
+ {
1984
+ id: "UndocumentedPublicProperty",
1985
+ category: "Documentation",
1986
+ severityLevel: "Info",
1987
+ title: "Enforce Documentation on Public Properties",
1988
+ enabled: false,
1989
+ parameters: []
1990
+ },
1991
+ {
1992
+ id: "UnnecessaryAbstractClass",
1993
+ category: "CodeStyle",
1994
+ severityLevel: "Info",
1995
+ title: "Avoid Unnecessary Abstract Classes",
1996
+ enabled: false,
1997
+ parameters: []
1998
+ },
1999
+ {
2000
+ id: "UnnecessaryAnnotationUseSiteTarget",
2001
+ category: "CodeStyle",
2002
+ severityLevel: "Info",
2003
+ title: "Avoid Unnecessary Annotation Use-Site Targets",
2004
+ enabled: false,
2005
+ parameters: []
2006
+ },
2007
+ {
2008
+ id: "UnnecessaryApply",
2009
+ category: "CodeStyle",
2010
+ severityLevel: "Info",
2011
+ title: "Avoid Unnecessary Usage of apply",
2012
+ enabled: false,
2013
+ parameters: []
2014
+ },
2015
+ {
2016
+ id: "UnnecessaryBackticks",
2017
+ category: "CodeStyle",
2018
+ severityLevel: "Info",
2019
+ title: "Avoid Unnecessary Backticks",
2020
+ enabled: false,
2021
+ parameters: []
2022
+ },
2023
+ {
2024
+ id: "UnnecessaryBracesAroundTrailingLambda",
2025
+ category: "CodeStyle",
2026
+ severityLevel: "Info",
2027
+ title: "Avoid Unnecessary Braces Around Trailing Lambda",
2028
+ enabled: false,
2029
+ parameters: []
2030
+ },
2031
+ {
2032
+ id: "UnnecessaryFilter",
2033
+ category: "CodeStyle",
2034
+ severityLevel: "Info",
2035
+ title: "Avoid Unnecessary filter() with Other Collection Operations",
2036
+ enabled: false,
2037
+ parameters: []
2038
+ },
2039
+ {
2040
+ id: "UnnecessaryInheritance",
2041
+ category: "CodeStyle",
2042
+ severityLevel: "Info",
2043
+ title: "Avoid Unnecessary Inheritance",
2044
+ enabled: false,
2045
+ parameters: []
2046
+ },
2047
+ {
2048
+ id: "UnnecessaryInnerClass",
2049
+ category: "CodeStyle",
2050
+ severityLevel: "Info",
2051
+ title: "Avoid Unnecessary 'inner' Qualifier on Nested Classes",
2052
+ enabled: false,
2053
+ parameters: []
2054
+ },
2055
+ {
2056
+ id: "UnnecessaryLet",
2057
+ category: "CodeStyle",
2058
+ severityLevel: "Info",
2059
+ title: "Avoid Unnecessary Usage of let",
2060
+ enabled: false,
2061
+ parameters: []
2062
+ },
2063
+ {
2064
+ id: "UnnecessaryNotNullCheck",
2065
+ category: "BestPractice",
2066
+ severityLevel: "Info",
2067
+ title: "Remove Unnecessary Not-Null Checks on Non-Null Types",
2068
+ enabled: false,
2069
+ parameters: []
2070
+ },
2071
+ {
2072
+ id: "UnnecessaryNotNullOperator",
2073
+ category: "CodeStyle",
2074
+ severityLevel: "Info",
2075
+ title: "Avoid Unnecessary Not-Null Unary Operator (!!)",
2076
+ enabled: false,
2077
+ parameters: []
2078
+ },
2079
+ {
2080
+ id: "UnnecessaryParentheses",
2081
+ category: "CodeStyle",
2082
+ severityLevel: "Info",
2083
+ title: "Remove Unnecessary Parentheses",
2084
+ enabled: false,
2085
+ parameters: []
2086
+ },
2087
+ {
2088
+ id: "UnnecessaryParenthesesBeforeTrailingLambda",
2089
+ category: "CodeStyle",
2090
+ severityLevel: "Info",
2091
+ title: "Avoid Unnecessary Parentheses Before Trailing Lambda",
2092
+ enabled: false,
2093
+ parameters: []
2094
+ },
2095
+ {
2096
+ id: "UnnecessaryPartOfBinaryExpression",
2097
+ category: "Performance",
2098
+ severityLevel: "Info",
2099
+ title: "Avoid Unnecessary Duplicate Conditions in Binary Expressions",
2100
+ enabled: false,
2101
+ parameters: []
2102
+ },
2103
+ {
2104
+ id: "UnnecessarySafeCall",
2105
+ category: "CodeStyle",
2106
+ severityLevel: "Info",
2107
+ title: "Avoid Unnecessary Safe Call Operator",
2108
+ enabled: false,
2109
+ parameters: []
2110
+ },
2111
+ {
2112
+ id: "UnnecessaryTemporaryInstantiation",
2113
+ category: "Performance",
2114
+ severityLevel: "Warning",
2115
+ title: "Avoid Unnecessary Temporary Object Instantiation When Converting Primitive Types to String",
2116
+ enabled: true,
2117
+ parameters: []
2118
+ },
2119
+ {
2120
+ id: "UnreachableCatchBlock",
2121
+ category: "ErrorProne",
2122
+ severityLevel: "Warning",
2123
+ title: "Avoid Unreachable Catch Blocks",
2124
+ enabled: false,
2125
+ parameters: []
2126
+ },
2127
+ {
2128
+ id: "UnreachableCode",
2129
+ category: "ErrorProne",
2130
+ severityLevel: "High",
2131
+ title: "Remove Unreachable Code",
2132
+ enabled: false,
2133
+ parameters: []
2134
+ },
2135
+ {
2136
+ id: "UnsafeCallOnNullableType",
2137
+ category: "ErrorProne",
2138
+ severityLevel: "High",
2139
+ title: "Avoid Unsafe Calls on Nullable Types",
2140
+ enabled: true,
2141
+ parameters: []
2142
+ },
2143
+ {
2144
+ id: "UnsafeCast",
2145
+ category: "ErrorProne",
2146
+ severityLevel: "Error",
2147
+ title: "Avoid Unsafe Casts",
2148
+ enabled: true,
2149
+ parameters: []
2150
+ },
2151
+ {
2152
+ id: "UntilInsteadOfRangeTo",
2153
+ category: "CodeStyle",
2154
+ severityLevel: "Info",
2155
+ title: "Replace '..' with 'until' for exclusive upper bounds",
2156
+ enabled: false,
2157
+ parameters: []
2158
+ },
2159
+ {
2160
+ id: "UnusedImports",
2161
+ category: "UnusedCode",
2162
+ severityLevel: "Info",
2163
+ title: "Remove Unused Imports",
2164
+ enabled: false,
2165
+ parameters: []
2166
+ },
2167
+ {
2168
+ id: "UnusedParameter",
2169
+ category: "CodeStyle",
2170
+ severityLevel: "Info",
2171
+ title: "Remove Unused Function Parameter",
2172
+ enabled: false,
2173
+ parameters: []
2174
+ },
2175
+ {
2176
+ id: "UnusedPrivateClass",
2177
+ category: "UnusedCode",
2178
+ severityLevel: "Warning",
2179
+ title: "Remove Unused Private Class",
2180
+ enabled: false,
2181
+ parameters: []
2182
+ },
2183
+ {
2184
+ id: "UnusedPrivateMember",
2185
+ category: "UnusedCode",
2186
+ severityLevel: "Warning",
2187
+ title: "Remove Unused Private Functions",
2188
+ enabled: false,
2189
+ parameters: []
2190
+ },
2191
+ {
2192
+ id: "UnusedPrivateProperty",
2193
+ category: "UnusedCode",
2194
+ severityLevel: "Warning",
2195
+ title: "Remove Unused Private Property",
2196
+ enabled: false,
2197
+ parameters: []
2198
+ },
2199
+ {
2200
+ id: "UnusedUnaryOperator",
2201
+ category: "ErrorProne",
2202
+ severityLevel: "High",
2203
+ title: "Avoid Unused Unary Operators",
2204
+ enabled: false,
2205
+ parameters: []
2206
+ },
2207
+ {
2208
+ id: "UseAnyOrNoneInsteadOfFind",
2209
+ category: "CodeStyle",
2210
+ severityLevel: "Info",
2211
+ title: "Use any or none Instead of find and null Checks",
2212
+ enabled: false,
2213
+ parameters: []
2214
+ },
2215
+ {
2216
+ id: "UseArrayLiteralsInAnnotations",
2217
+ category: "CodeStyle",
2218
+ severityLevel: "Info",
2219
+ title: "Prefer Array Literals in Annotations",
2220
+ enabled: false,
2221
+ parameters: []
2222
+ },
2223
+ {
2224
+ id: "UseCheckNotNull",
2225
+ category: "CodeStyle",
2226
+ severityLevel: "Info",
2227
+ title: "Use checkNotNull() Instead of check() for Null Checks",
2228
+ enabled: false,
2229
+ parameters: []
2230
+ },
2231
+ {
2232
+ id: "UseCheckOrError",
2233
+ category: "BestPractice",
2234
+ severityLevel: "Info",
2235
+ title: "Use check() or error() Instead of Throwing IllegalStateException",
2236
+ enabled: false,
2237
+ parameters: []
2238
+ },
2239
+ {
2240
+ id: "UseDataClass",
2241
+ category: "CodeStyle",
2242
+ severityLevel: "Info",
2243
+ title: "Replace Classes That Only Hold Data with Data Classes",
2244
+ enabled: false,
2245
+ parameters: []
2246
+ },
2247
+ {
2248
+ id: "UseEmptyCounterpart",
2249
+ category: "CodeStyle",
2250
+ severityLevel: "Info",
2251
+ title: "Use Empty Initializer for Object's Empty State",
2252
+ enabled: false,
2253
+ parameters: []
2254
+ },
2255
+ {
2256
+ id: "UseEntityAtName",
2257
+ category: "BestPractice",
2258
+ severityLevel: "Info",
2259
+ title: "Prefer Entity.atName over Entity.from with nameIdentifier",
2260
+ enabled: false,
2261
+ parameters: []
2262
+ },
2263
+ {
2264
+ id: "UseIfEmptyOrIfBlank",
2265
+ category: "CodeStyle",
2266
+ severityLevel: "Info",
2267
+ title: "Use ifEmpty or ifBlank Instead of isEmpty or isBlank for Default Values",
2268
+ enabled: false,
2269
+ parameters: []
2270
+ },
2271
+ {
2272
+ id: "UseIfInsteadOfWhen",
2273
+ category: "CodeStyle",
2274
+ severityLevel: "Info",
2275
+ title: "Use If Expression Instead of When for Binary Expressions",
2276
+ enabled: false,
2277
+ parameters: []
2278
+ },
2279
+ {
2280
+ id: "UseIsNullOrEmpty",
2281
+ category: "CodeStyle",
2282
+ severityLevel: "Info",
2283
+ title: "Enforce use of isNullOrEmpty() instead of explicit null or empty checks",
2284
+ enabled: false,
2285
+ parameters: []
2286
+ },
2287
+ {
2288
+ id: "UselessCallOnNotNull",
2289
+ category: "CodeStyle",
2290
+ severityLevel: "Info",
2291
+ title: "Avoid Useless Calls on Non-Null References",
2292
+ enabled: false,
2293
+ parameters: []
2294
+ },
2295
+ {
2296
+ id: "UselessPostfixExpression",
2297
+ category: "ErrorProne",
2298
+ severityLevel: "Warning",
2299
+ title: "Avoid Useless Postfix Expressions",
2300
+ enabled: true,
2301
+ parameters: []
2302
+ },
2303
+ {
2304
+ id: "UseLet",
2305
+ category: "CodeStyle",
2306
+ severityLevel: "Info",
2307
+ title: "Use `?.let {}` Instead of if/else Null Checks",
2308
+ enabled: false,
2309
+ parameters: []
2310
+ },
2311
+ {
2312
+ id: "UseOrEmpty",
2313
+ category: "CodeStyle",
2314
+ severityLevel: "Info",
2315
+ title: "Use orEmpty() Instead of ?: with Empty Collection Factory Methods",
2316
+ enabled: false,
2317
+ parameters: []
2318
+ },
2319
+ {
2320
+ id: "UseRequire",
2321
+ category: "BestPractice",
2322
+ severityLevel: "Info",
2323
+ title: "Use require() Instead of Throwing IllegalArgumentException",
2324
+ enabled: false,
2325
+ parameters: []
2326
+ },
2327
+ {
2328
+ id: "UseRequireNotNull",
2329
+ category: "CodeStyle",
2330
+ severityLevel: "Info",
2331
+ title: "Use requireNotNull for Not-Null Checks",
2332
+ enabled: false,
2333
+ parameters: []
2334
+ },
2335
+ {
2336
+ id: "UseSumOfInsteadOfFlatMapSize",
2337
+ category: "Performance",
2338
+ severityLevel: "Info",
2339
+ title: "Use sumOf instead of flatMap and size/count calls",
2340
+ enabled: false,
2341
+ parameters: []
2342
+ },
2343
+ {
2344
+ id: "UtilityClassWithPublicConstructor",
2345
+ category: "BestPractice",
2346
+ severityLevel: "Warning",
2347
+ title: "Avoid Utility Classes with Public Constructor",
2348
+ enabled: false,
2349
+ parameters: []
2350
+ },
2351
+ {
2352
+ id: "VarCouldBeVal",
2353
+ category: "BestPractice",
2354
+ severityLevel: "Info",
2355
+ title: "Enforce val for Immutable Declarations",
2356
+ enabled: false,
2357
+ parameters: []
2358
+ },
2359
+ {
2360
+ id: "VariableMaxLength",
2361
+ category: "CodeStyle",
2362
+ severityLevel: "Info",
2363
+ title: "Enforce Maximum Variable Name Length",
2364
+ enabled: false,
2365
+ parameters: []
2366
+ },
2367
+ {
2368
+ id: "VariableMinLength",
2369
+ category: "CodeStyle",
2370
+ severityLevel: "Info",
2371
+ title: "Enforce Minimum Variable Name Length",
2372
+ enabled: false,
2373
+ parameters: []
2374
+ },
2375
+ {
2376
+ id: "VariableNaming",
2377
+ category: "CodeStyle",
2378
+ severityLevel: "Info",
2379
+ title: "Enforce Variable Naming Convention",
2380
+ enabled: false,
2381
+ parameters: []
2382
+ },
2383
+ {
2384
+ id: "ViolatesTypeResolutionRequirements",
2385
+ category: "BestPractice",
2386
+ severityLevel: "Warning",
2387
+ title: "Enforce Correct Usage of @RequiresTypeResolution Annotation",
2388
+ enabled: false,
2389
+ parameters: []
2390
+ },
2391
+ {
2392
+ id: "WildcardImport",
2393
+ category: "CodeStyle",
2394
+ severityLevel: "Info",
2395
+ title: "Avoid Wildcard Imports",
2396
+ enabled: false,
2397
+ parameters: []
2398
+ },
2399
+ {
2400
+ id: "Wrapping",
2401
+ category: "CodeStyle",
2402
+ severityLevel: "Info",
2403
+ title: "Enforce Proper Wrapping with Newlines in Multi-line Function Calls",
2404
+ enabled: false,
2405
+ parameters: []
2406
+ },
2407
+ {
2408
+ id: "WrongEqualsTypeParameter",
2409
+ category: "ErrorProne",
2410
+ severityLevel: "High",
2411
+ title: "Enforce correct parameter type for equals() method",
2412
+ enabled: true,
2413
+ parameters: []
2414
+ }
2415
+ ];
2416
+
2417
+ // src/adapter.ts
2418
+ var TOOL_ID = "detekt";
2419
+ var DETEKT_VERSION = "1.23.8";
2420
+ var JAR_NAME = `detekt-cli-${DETEKT_VERSION}-all.jar`;
2421
+ var JAR_URL = `https://github.com/detekt/detekt/releases/download/v${DETEKT_VERSION}/${JAR_NAME}`;
2422
+ var JAVA_VERSION_RANGE = ">=8";
2423
+ var PATTERN_META = new Map(
2424
+ patterns_default.map((p) => [
2425
+ p.id,
2426
+ {
2427
+ category: p.category,
2428
+ severity: p.severityLevel ?? "Info"
2429
+ }
2430
+ ])
2431
+ );
2432
+ function ruleMetadata(ruleId) {
2433
+ return PATTERN_META.get(ruleId) ?? { category: "CodeStyle", severity: "Info" };
2434
+ }
2435
+ var xmlParser = new import_fast_xml_parser.XMLParser({
2436
+ ignoreAttributes: false,
2437
+ attributeNamePrefix: "@_",
2438
+ isArray: (name) => name === "file" || name === "error"
2439
+ });
2440
+ function getLineContent(lines, lineNumber) {
2441
+ return lines[lineNumber - 1] ?? "";
2442
+ }
2443
+ async function readFileLines(filePath) {
2444
+ try {
2445
+ const content = await import_promises.default.readFile(filePath, "utf-8");
2446
+ return content.split("\n");
2447
+ } catch {
2448
+ return [];
2449
+ }
2450
+ }
2451
+ function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
2452
+ const durationMs = completedAt.getTime() - startedAt.getTime();
2453
+ return {
2454
+ metadata: {
2455
+ startedAt: startedAt.toISOString(),
2456
+ completedAt: completedAt.toISOString(),
2457
+ durationMs
2458
+ },
2459
+ issues,
2460
+ errors,
2461
+ summary: {
2462
+ toolId: TOOL_ID,
2463
+ status: errors.some((e) => e.level === "error") ? "partial" : "success",
2464
+ issueCount: issues.length,
2465
+ errorCount: errors.length,
2466
+ durationMs,
2467
+ filesAnalyzed
2468
+ }
2469
+ };
2470
+ }
2471
+ function extractRuleId(source) {
2472
+ let ruleId = source.startsWith("detekt.") ? source.slice(7) : source;
2473
+ const lastDot = ruleId.lastIndexOf(".");
2474
+ if (lastDot >= 0) {
2475
+ ruleId = ruleId.slice(lastDot + 1);
2476
+ }
2477
+ return ruleId;
2478
+ }
2479
+ async function resolveJavaPath(ctx) {
2480
+ const jreDir = import_path.default.join(ctx.globalDir, "runtimes", "java-17");
2481
+ const javaBin = import_path.default.join(jreDir, "bin", "java");
2482
+ try {
2483
+ await import_promises.default.access(javaBin);
2484
+ return javaBin;
2485
+ } catch {
2486
+ }
2487
+ if (process.env.JAVA_HOME) {
2488
+ const javaHome = import_path.default.join(process.env.JAVA_HOME, "bin", "java");
2489
+ try {
2490
+ await import_promises.default.access(javaHome);
2491
+ return javaHome;
2492
+ } catch {
2493
+ }
2494
+ }
2495
+ return "java";
2496
+ }
2497
+ async function resolveJarPath(ctx) {
2498
+ const jarPath = import_path.default.join(ctx.toolInstallDir, JAR_NAME);
2499
+ try {
2500
+ await import_promises.default.access(jarPath);
2501
+ return jarPath;
2502
+ } catch {
2503
+ return null;
2504
+ }
2505
+ }
2506
+ var CONFIG_FILE_CANDIDATES = ["detekt.yml", "default-detekt-config.yml"];
2507
+ var adapter = {
2508
+ id: TOOL_ID,
2509
+ displayName: "detekt",
2510
+ preferredVersion: DETEKT_VERSION,
2511
+ compatibleVersions: ">=1.20.0",
2512
+ website: "https://detekt.dev/",
2513
+ languages: ["Kotlin"],
2514
+ filePatterns: ["**/*.kt", "**/*.kts"],
2515
+ supportedOS: ["linux", "darwin"],
2516
+ supportedArch: ["x64", "arm64"],
2517
+ supportedRunners: ["local", "container"],
2518
+ prerequisites: [
2519
+ {
2520
+ name: "Java",
2521
+ versionRange: JAVA_VERSION_RANGE,
2522
+ preferredVersion: "17",
2523
+ checkCommand: "java -version"
2524
+ }
2525
+ ],
2526
+ /**
2527
+ * Checks whether detekt is available (Java runtime + detekt JAR).
2528
+ *
2529
+ * Checks:
2530
+ * 1. Java runtime via findJava (JAVA_HOME, then PATH)
2531
+ * 2. detekt CLI JAR in the tool install directory
2532
+ *
2533
+ * Reports Java as a dependency in the return value.
2534
+ */
2535
+ async checkAvailability(ctx) {
2536
+ ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
2537
+ const javaInfo = await (0, import_tooling.findJava)(JAVA_VERSION_RANGE, ctx.logger).catch(() => null);
2538
+ const dependencies = javaInfo ? [{ name: "Java", available: true, version: javaInfo.version, installation: "global" }] : [{ name: "Java", available: false, reason: `Java (${JAVA_VERSION_RANGE}) not found` }];
2539
+ if (!javaInfo) {
2540
+ const jreDir = import_path.default.join(ctx.globalDir, "runtimes", "java-17");
2541
+ const javaBin = import_path.default.join(jreDir, "bin", "java");
2542
+ try {
2543
+ await import_promises.default.access(javaBin);
2544
+ dependencies[0] = { name: "Java", available: true, version: "17", installation: "codacy" };
2545
+ } catch {
2546
+ return {
2547
+ available: false,
2548
+ reason: "Java runtime not found (required for detekt)",
2549
+ installHint: "Install JDK 17+, or run with --install-dependencies for auto-download",
2550
+ dependencies
2551
+ };
2552
+ }
2553
+ }
2554
+ const jarPath = await resolveJarPath(ctx);
2555
+ if (jarPath) {
2556
+ ctx.logger.debug("detekt available", { toolId: TOOL_ID, version: DETEKT_VERSION });
2557
+ return {
2558
+ available: true,
2559
+ version: DETEKT_VERSION,
2560
+ path: jarPath,
2561
+ installation: "codacy",
2562
+ dependencies
2563
+ };
2564
+ }
2565
+ ctx.logger.debug("detekt not found", { toolId: TOOL_ID });
2566
+ return {
2567
+ available: false,
2568
+ reason: `detekt JAR not found at ${import_path.default.join(ctx.toolInstallDir, JAR_NAME)}`,
2569
+ installHint: "Run with --install-dependencies to auto-download, or manually place the JAR",
2570
+ dependencies
2571
+ };
2572
+ },
2573
+ /**
2574
+ * Installs detekt by ensuring a JRE is available and downloading the
2575
+ * detekt CLI all-in-one JAR from GitHub releases.
2576
+ *
2577
+ * Uses ensureJre() to download Adoptium Temurin JDK 17 if no system Java
2578
+ * is found, then downloadJar() to fetch the detekt CLI JAR.
2579
+ */
2580
+ async install(ctx) {
2581
+ ctx.logger.info("Starting install", { toolId: TOOL_ID });
2582
+ const java = await (0, import_tooling.ensureJre)(ctx.globalDir, JAVA_VERSION_RANGE, ctx.logger);
2583
+ if (!java) {
2584
+ return {
2585
+ success: false,
2586
+ error: {
2587
+ toolId: TOOL_ID,
2588
+ phase: "requirementCheck",
2589
+ kind: "MissingPrerequisite",
2590
+ message: `Java (${JAVA_VERSION_RANGE}) could not be found or downloaded. detekt requires a JDK/JRE.`,
2591
+ level: "error"
2592
+ }
2593
+ };
2594
+ }
2595
+ try {
2596
+ ctx.logger.info(`Downloading detekt CLI JAR to ${ctx.toolInstallDir}...`);
2597
+ const jarPath = await (0, import_tooling.downloadJar)(JAR_URL, ctx.toolInstallDir, JAR_NAME, ctx.logger);
2598
+ ctx.logger.info(`Installed detekt to ${jarPath}`);
2599
+ return { success: true, installedPath: jarPath, installedVersion: DETEKT_VERSION };
2600
+ } catch (err) {
2601
+ return {
2602
+ success: false,
2603
+ error: {
2604
+ toolId: TOOL_ID,
2605
+ phase: "toolInstall",
2606
+ kind: "InstallError",
2607
+ message: `Failed to download detekt JAR: ${err instanceof Error ? err.message : String(err)}`,
2608
+ level: "error"
2609
+ }
2610
+ };
2611
+ }
2612
+ },
2613
+ /**
2614
+ * Checks for detekt configuration files in the repository root.
2615
+ *
2616
+ * Looks for `detekt.yml` or `default-detekt-config.yml` (in that order).
2617
+ * Returns the first found file.
2618
+ */
2619
+ async checkLocalConfigurationFile(ctx) {
2620
+ ctx.logger.debug("Checking for local config", { toolId: TOOL_ID });
2621
+ for (const candidate of CONFIG_FILE_CANDIDATES) {
2622
+ const candidatePath = import_path.default.join(ctx.repositoryRoot, candidate);
2623
+ try {
2624
+ await import_promises.default.access(candidatePath);
2625
+ ctx.logger.debug("Local config found", { toolId: TOOL_ID, path: candidatePath });
2626
+ return { found: true, path: candidatePath };
2627
+ } catch {
2628
+ }
2629
+ }
2630
+ return { found: false };
2631
+ },
2632
+ /**
2633
+ * Runs detekt against the target Kotlin files and converts the Checkstyle
2634
+ * XML output into Codacy Issue objects.
2635
+ *
2636
+ * Config resolution:
2637
+ * - If `useLocalConfigurationFile` is true and a local config is found,
2638
+ * passes `--config <path>` to detekt.
2639
+ * - Otherwise, detekt runs with its built-in defaults and output is
2640
+ * post-filtered by enabled patterns.
2641
+ *
2642
+ * Key details:
2643
+ * - `--report xml:<tmpFile>` writes Checkstyle 4.3 XML to a temp file.
2644
+ * - `--base-path <repoRoot>` ensures relative paths in output.
2645
+ * - `--parallel` enables parallel analysis for performance.
2646
+ * - `--fail-on-severity Never` prevents non-zero exit codes for findings.
2647
+ * - The `source` attribute in XML has format `detekt.RuleName` — we strip
2648
+ * the `detekt.` prefix to get the pattern ID.
2649
+ *
2650
+ * Exit codes: 0 = success with --fail-on-severity Never.
2651
+ *
2652
+ * Never throws — all errors are captured in the returned `errors` array.
2653
+ */
2654
+ async analyze(ctx, codacyConfig) {
2655
+ const startMs = Date.now();
2656
+ ctx.logger.info("Starting analysis", { toolId: TOOL_ID, fileCount: ctx.targetFiles.length });
2657
+ const startedAt = /* @__PURE__ */ new Date();
2658
+ const issues = [];
2659
+ const errors = [];
2660
+ if (ctx.targetFiles.length === 0) {
2661
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, 0);
2662
+ }
2663
+ const javaBin = await resolveJavaPath(ctx);
2664
+ const jarPath = await resolveJarPath(ctx);
2665
+ if (!jarPath) {
2666
+ errors.push({
2667
+ toolId: TOOL_ID,
2668
+ phase: "toolInvoke",
2669
+ kind: "MissingPrerequisite",
2670
+ message: `detekt JAR not found at ${import_path.default.join(ctx.toolInstallDir, JAR_NAME)}. Run install first.`,
2671
+ level: "error"
2672
+ });
2673
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2674
+ }
2675
+ const tmpDir = await import_promises.default.mkdtemp(import_path.default.join(import_os.default.tmpdir(), "detekt-"));
2676
+ const reportFile = import_path.default.join(tmpDir, "detekt-report.xml");
2677
+ const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
2678
+ const inputPaths = absoluteFiles.join(",");
2679
+ const args = [
2680
+ "-jar",
2681
+ jarPath,
2682
+ "--input",
2683
+ inputPaths,
2684
+ "--report",
2685
+ `xml:${reportFile}`,
2686
+ "--base-path",
2687
+ ctx.repositoryRoot,
2688
+ "--parallel"
2689
+ ];
2690
+ const useLocal = codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile;
2691
+ if (useLocal) {
2692
+ args.push("--config", codacyConfig.localConfigurationFile);
2693
+ }
2694
+ try {
2695
+ const { stderr, exitCode } = await (0, import_tooling.spawnTool)(javaBin, args, {
2696
+ cwd: ctx.repositoryRoot,
2697
+ logger: ctx.logger
2698
+ });
2699
+ if (exitCode > 2) {
2700
+ errors.push({
2701
+ toolId: TOOL_ID,
2702
+ phase: "toolInvoke",
2703
+ kind: "NonZeroExit",
2704
+ message: `detekt exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
2705
+ level: "error"
2706
+ });
2707
+ await cleanupTmpDir(tmpDir);
2708
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2709
+ }
2710
+ let xmlContent;
2711
+ try {
2712
+ xmlContent = await import_promises.default.readFile(reportFile, "utf-8");
2713
+ } catch {
2714
+ if (stderr && stderr.trim()) {
2715
+ errors.push({
2716
+ toolId: TOOL_ID,
2717
+ phase: "outputParse",
2718
+ kind: "ParseWarning",
2719
+ message: `detekt stderr: ${stderr.trim()}`,
2720
+ level: "warning"
2721
+ });
2722
+ }
2723
+ await cleanupTmpDir(tmpDir);
2724
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2725
+ }
2726
+ if (!xmlContent.trim()) {
2727
+ await cleanupTmpDir(tmpDir);
2728
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2729
+ }
2730
+ let files;
2731
+ try {
2732
+ const parsed = xmlParser.parse(xmlContent);
2733
+ files = parsed?.checkstyle?.file ?? [];
2734
+ } catch (err) {
2735
+ errors.push({
2736
+ toolId: TOOL_ID,
2737
+ phase: "outputParse",
2738
+ kind: "MalformedOutput",
2739
+ message: `Failed to parse detekt XML output: ${err instanceof Error ? err.message : String(err)}`,
2740
+ level: "error"
2741
+ });
2742
+ await cleanupTmpDir(tmpDir);
2743
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2744
+ }
2745
+ const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
2746
+ for (const file of files) {
2747
+ const filePath = file["@_name"];
2748
+ if (!filePath) continue;
2749
+ const fileErrors = file.error ?? [];
2750
+ if (fileErrors.length === 0) continue;
2751
+ const relPath = import_path.default.isAbsolute(filePath) ? import_path.default.relative(ctx.repositoryRoot, filePath) : filePath;
2752
+ const absolutePath = import_path.default.resolve(ctx.repositoryRoot, relPath);
2753
+ const lines = await readFileLines(absolutePath);
2754
+ for (const error of fileErrors) {
2755
+ const source = error["@_source"] ?? "";
2756
+ const ruleId = extractRuleId(source);
2757
+ if (!ruleId) continue;
2758
+ const patternId = ruleId;
2759
+ if (enabledPatterns.size > 0 && !enabledPatterns.has(patternId)) {
2760
+ continue;
2761
+ }
2762
+ const line = parseInt(error["@_line"], 10) || 1;
2763
+ const column = parseInt(error["@_column"] ?? "1", 10) || 1;
2764
+ const meta = ruleMetadata(ruleId);
2765
+ issues.push({
2766
+ filePath: relPath,
2767
+ patternId,
2768
+ toolId: TOOL_ID,
2769
+ line,
2770
+ column,
2771
+ message: error["@_message"],
2772
+ lineContent: getLineContent(lines, line),
2773
+ category: meta.category,
2774
+ severity: meta.severity
2775
+ });
2776
+ }
2777
+ }
2778
+ const stderrFiltered = stderr.split("\n").filter((line) => {
2779
+ const trimmed = line.trim();
2780
+ if (!trimmed) return false;
2781
+ if (trimmed.startsWith("Running detekt")) return false;
2782
+ if (trimmed.startsWith("Complexity report")) return false;
2783
+ if (trimmed.includes("number of ")) return false;
2784
+ return true;
2785
+ }).join("\n").trim();
2786
+ if (stderrFiltered) {
2787
+ errors.push({
2788
+ toolId: TOOL_ID,
2789
+ phase: "outputParse",
2790
+ kind: "ParseWarning",
2791
+ message: `detekt stderr: ${stderrFiltered}`,
2792
+ level: "warning"
2793
+ });
2794
+ }
2795
+ await cleanupTmpDir(tmpDir);
2796
+ } catch (invokeErr) {
2797
+ errors.push({
2798
+ toolId: TOOL_ID,
2799
+ phase: "toolInvoke",
2800
+ kind: "InvocationError",
2801
+ message: `Failed to run detekt: ${invokeErr instanceof Error ? invokeErr.message : String(invokeErr)}`,
2802
+ level: "error"
2803
+ });
2804
+ await cleanupTmpDir(tmpDir);
2805
+ }
2806
+ const durationMs = Date.now() - startMs;
2807
+ ctx.logger.info("Analysis complete", { toolId: TOOL_ID, issueCount: issues.length, errorCount: errors.length, durationMs });
2808
+ return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
2809
+ }
2810
+ };
2811
+ async function cleanupTmpDir(tmpDir) {
2812
+ try {
2813
+ await import_promises.default.rm(tmpDir, { recursive: true });
2814
+ } catch {
2815
+ }
2816
+ }
2817
+
2818
+ // src/index.ts
2819
+ var index_default = (0, import_tooling2.defineToolAdapter)(adapter);