-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-smells-corpus.json
More file actions
3256 lines (3256 loc) · 132 KB
/
Copy pathcode-smells-corpus.json
File metadata and controls
3256 lines (3256 loc) · 132 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
{
"version": "code-smells-corpus-v1",
"source": "doloop canonical research (7 streams + completeness critic)",
"entries": [
{
"id": "CS-001",
"name": "Long Method",
"category": "Bloater",
"description": "A method or function has grown so long that it does too many things and is hard to understand, reuse, test, and change.",
"detection": "Executable-LOC per function body > 30-50 (warn) / > 60-100 (fail) via AST function-node span; or cyclomatic complexity > 10; or statement count > 25-50.",
"determinism": "mechanical",
"aliases": [
"Long Function",
"God Method",
"Brain Method"
],
"fix_hint": "Extract Function on cohesive blocks; Replace Temp with Query.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring (1999/2018)",
"PMD ExcessiveMethodLength; ESLint max-lines-per-function"
]
},
{
"id": "CS-002",
"name": "Large Class / God Class",
"category": "Bloater",
"description": "A class is trying to do too much, accumulating too many fields, methods, and responsibilities.",
"detection": "Methods/class > 20, fields > 15, or class LOC > 500 (warn) / > 1000 (fail). Lanza God Class: WMC>=47 AND TCC<0.33 AND ATFD>5.",
"determinism": "mechanical",
"aliases": [
"God Object",
"Blob"
],
"fix_hint": "Extract Class / Extract Subclass / Extract Interface.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"Lanza & Marinescu (2006)",
"DECOR Blob (Moha et al. 2010)"
]
},
{
"id": "CS-003",
"name": "Duplicated Code",
"category": "Dispensable",
"description": "The same or nearly-identical code structure appears in more than one place.",
"detection": "Token/AST clone detection (Type-1/2/3): >=6 duplicated statements or >=40-50 tokens with >85% similarity appearing >=2 times.",
"determinism": "mechanical",
"aliases": [
"Copy-Paste Programming",
"DRY Violation",
"CPD"
],
"fix_hint": "Extract Function; Pull Up Method; Form Template Method.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"PMD CPD; SonarQube"
]
},
{
"id": "CS-004",
"name": "Long Parameter List",
"category": "Bloater",
"description": "A method takes so many parameters that callers struggle to understand and supply them correctly.",
"detection": "Parameter count > 4 (warn) / > 6 (fail). PMD 10, Checkstyle 7, pylint 5, ESLint 3.",
"determinism": "mechanical",
"aliases": [
"Too Many Parameters",
"max-params"
],
"fix_hint": "Introduce Parameter Object; Preserve Whole Object; Remove Flag Argument.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"PMD; Checkstyle; ESLint max-params"
]
},
{
"id": "CS-005",
"name": "Global Data",
"category": "Mutable-State / Coupler",
"description": "Data accessible from anywhere can be mutated by any code, making changes impossible to trace.",
"detection": "Count module/global-scope mutable bindings, public static mutable fields, singletons with mutable state.",
"determinism": "mechanical",
"aliases": [
"Global State"
],
"fix_hint": "Encapsulate Variable; reduce scope; pass state explicitly.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler, Refactoring 2nd ed. (2018)"
]
},
{
"id": "CS-006",
"name": "Mutable Data",
"category": "Mutable-State",
"description": "Data updated in place can be changed where another part assumed it would not.",
"detection": "Reassigned vars that could be const/final, shared mutable objects mutated by reference, public mutable fields. Reader judges essential vs incidental.",
"determinism": "hybrid",
"aliases": [],
"fix_hint": "Encapsulate Variable; Split Variable; Change Reference to Value.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler, Refactoring 2nd ed. (2018)"
]
},
{
"id": "CS-007",
"name": "Divergent Change",
"category": "Change Preventer",
"description": "One class is changed in many different ways for many different reasons.",
"detection": "A single file/class touched by commits addressing >=3 distinct concern clusters; low cohesion (LCOM4>1). Reader confirms unrelated reasons.",
"determinism": "hybrid",
"aliases": [],
"fix_hint": "Extract Class to split divergent contexts; Split Phase.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"Lanza & Marinescu"
]
},
{
"id": "CS-008",
"name": "Shotgun Surgery",
"category": "Change Preventer",
"description": "A single conceptual change forces many small edits scattered across many classes.",
"detection": "Version-history: a logical change co-modifies N>5 files; high fan-out dispersion. Reader confirms one change.",
"determinism": "hybrid",
"aliases": [
"Scattered Change"
],
"fix_hint": "Move Function / Move Field to gather behavior; Combine Functions into Class.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"Gall et al. change-coupling"
]
},
{
"id": "CS-009",
"name": "Feature Envy",
"category": "Coupler",
"description": "A method is more interested in another class's data than its own.",
"detection": "Per method, foreign accesses to one other class vs host; flag foreign>host. Lanza: ATFD>3 AND LAA<0.33 AND FDP<=3.",
"determinism": "mechanical",
"aliases": [
"Misplaced Method"
],
"fix_hint": "Move Function to envied class; Extract then Move.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"JDeodorant; GRASP Information Expert"
]
},
{
"id": "CS-010",
"name": "Data Clumps",
"category": "Bloater",
"description": "The same group of data items keeps appearing together in fields and parameter lists.",
"detection": "Identical ordered groups of >=3 params/fields recurring across >=2 signatures (name+type tuple). Warn at 2, fail at 3+.",
"determinism": "mechanical",
"aliases": [],
"fix_hint": "Extract Class; Introduce Parameter Object.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-011",
"name": "Primitive Obsession",
"category": "Bloater",
"description": "Primitives represent domain concepts that deserve their own small types.",
"detection": "Type-code constants, primitive fields named like domain quantities without wrappers, arrays as records. Reader confirms a concept is a bare primitive.",
"determinism": "hybrid",
"aliases": [
"Stringly-typed code"
],
"fix_hint": "Replace Primitive with Object; Replace Type Code with Subclasses.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-012",
"name": "Repeated Switches / Switch Statement",
"category": "Object-Orientation Abuser",
"description": "The same conditional switch on a type code recurs in multiple places.",
"detection": ">=2 switch/if-else ladders on the same discriminant. Warn at 2, fail at 3+. Reader confirms polymorphism is right.",
"determinism": "hybrid",
"aliases": [
"Type-Checking Conditionals"
],
"fix_hint": "Replace Conditional with Polymorphism; State/Strategy; dispatch table.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-013",
"name": "Loops",
"category": "Dispensable",
"description": "An explicit imperative loop is used where a collection pipeline would express intent more clearly.",
"detection": "Loop bodies matching map/filter/reduce shapes. Reader confirms pure transformation, no early-exit complications.",
"determinism": "hybrid",
"aliases": [
"Imperative Loop over Pipeline"
],
"fix_hint": "Replace Loop with Pipeline; Extract Function.",
"severity_default": "info",
"languages": "languages with collection pipelines",
"sources": [
"Fowler, Refactoring 2nd ed. (2018)"
]
},
{
"id": "CS-014",
"name": "Parallel Inheritance Hierarchies",
"category": "Change Preventer",
"description": "Adding a subclass to one hierarchy forces a matching subclass in another.",
"detection": "Two hierarchies whose subclass name prefixes correspond 1:1 and co-add historically.",
"determinism": "hybrid",
"aliases": [],
"fix_hint": "Move Function/Field so one hierarchy refers to the other; collapse.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring 1st ed. (1999)"
]
},
{
"id": "CS-015",
"name": "Lazy Class / Lazy Element",
"category": "Dispensable",
"description": "A class or element no longer pulls its weight.",
"detection": "Class with <=1-2 methods and few fields and few references, or a forwarding-only function.",
"determinism": "mechanical",
"aliases": [
"Freeloader"
],
"fix_hint": "Inline Class; Collapse Hierarchy; Inline Function.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring"
]
},
{
"id": "CS-016",
"name": "Speculative Generality",
"category": "Dispensable",
"description": "Machinery added for hypothetical future needs that nobody uses today.",
"detection": "Abstract types with a single implementor, unused params/hooks, methods with only test callers, single-impl factory/strategy. Reader confirms no current use.",
"determinism": "hybrid",
"aliases": [
"YAGNI violation",
"Over-Engineering"
],
"fix_hint": "Collapse Hierarchy; Inline; drop unused params; Remove Dead Code.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring",
"Rastogi 66 Anti-Patterns #56/#57",
"arXiv:2510.03029"
]
},
{
"id": "CS-017",
"name": "Temporary Field",
"category": "Object-Orientation Abuser",
"description": "An instance field is meaningful only in certain circumstances.",
"detection": "Field assigned/read only inside one method cluster (used by <50% of methods). Reader confirms scratch state vs lazy cache.",
"determinism": "hybrid",
"aliases": [],
"fix_hint": "Extract Class; Introduce Special Case (Null Object).",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring"
]
},
{
"id": "CS-018",
"name": "Message Chains",
"category": "Coupler",
"description": "A client navigates a long chain of object-to-object calls.",
"detection": "AST chain of >=3 consecutive accessor calls. Warn at depth 3, fail at 4+. Exclude fluent-builder allowlist.",
"determinism": "mechanical",
"aliases": [
"Train Wreck",
"Law of Demeter violation"
],
"fix_hint": "Hide Delegate; Extract then Move Function.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"Law of Demeter (Lieberherr)"
]
},
{
"id": "CS-019",
"name": "Middle Man",
"category": "Coupler",
"description": "A class delegates almost all of its work to another.",
"detection": "Pure-delegating methods / total methods > 50% (warn) / >75% (fail).",
"determinism": "mechanical",
"aliases": [
"Excessive Delegation"
],
"fix_hint": "Remove Middle Man; Inline Function.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring"
]
},
{
"id": "CS-020",
"name": "Insider Trading / Inappropriate Intimacy",
"category": "Coupler",
"description": "Two modules trade private data and reach into each other's internals.",
"detection": "Bidirectional coupling: A accesses B's privates AND B accesses A's. Warn when mutual foreign accesses > 3.",
"determinism": "mechanical",
"aliases": [
"Inappropriate Intimacy",
"Bidirectional Coupling"
],
"fix_hint": "Move Function/Field; Hide Delegate; Replace Inheritance with Delegation.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring"
]
},
{
"id": "CS-021",
"name": "Alternative Classes with Different Interfaces",
"category": "Object-Orientation Abuser",
"description": "Two classes do the same job but expose different method names/signatures.",
"detection": "High behavior overlap but mismatched names (behavior Jaccard high, name match low), or >=80% identical bodies. Reader confirms equivalence.",
"determinism": "hybrid",
"aliases": [
"Duplicate Abstraction"
],
"fix_hint": "Change Function Declaration to align; Extract Superclass.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-022",
"name": "Data Class",
"category": "Dispensable",
"description": "A class is just fields with getters/setters and no behavior.",
"detection": "Methods exclusively accessors while other classes manipulate its fields. Lanza: low WOC, high NOAP+NOAM. Exclude DTO/record allowlist.",
"determinism": "mechanical",
"aliases": [
"Anemic Object",
"data holder"
],
"fix_hint": "Move Function in; Encapsulate Collection; Remove Setting Method.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Fowler & Beck, Refactoring",
"Lanza & Marinescu"
]
},
{
"id": "CS-023",
"name": "Refused Bequest / Rebellious Hierarchy",
"category": "Object-Orientation Abuser",
"description": "A subclass uses only some of what it inherits and overrides-to-empty/throw the rest.",
"detection": "Override to throw Unsupported/NotImplemented/no-op, or uses <50% of inherited members. Reader decides push-down vs replace-inheritance.",
"determinism": "hybrid",
"aliases": [
"Inappropriate Inheritance"
],
"fix_hint": "Push Down Method/Field; Replace Subclass/Superclass with Delegate.",
"severity_default": "warn",
"languages": "OO languages with inheritance",
"sources": [
"Fowler & Beck, Refactoring",
"Liskov & Wing (1994)"
]
},
{
"id": "CS-024",
"name": "Comments (Deodorant)",
"category": "Dispensable / Comprehensibility",
"description": "Comments used to explain confusing code that should explain itself.",
"detection": "High inline-comment density inside method bodies, or a comment preceding an extractable block. Reader distinguishes deodorant from why/contract docs.",
"determinism": "hybrid",
"aliases": [
"Explanatory Comments"
],
"fix_hint": "Extract Function; Rename; Introduce Assertion.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring"
]
},
{
"id": "CS-025",
"name": "Incomplete Library Class",
"category": "Dispensable / Coupler",
"description": "A reused library class lacks a method you need but cannot modify.",
"detection": "Many local util functions whose first argument is the same third-party type. Reader confirms missing library capability.",
"determinism": "hybrid",
"aliases": [],
"fix_hint": "Introduce Foreign Method; Introduce Local Extension.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler & Beck, Refactoring 1st ed. (1999)"
]
},
{
"id": "CS-026",
"name": "Mysterious Name",
"category": "Comprehensibility",
"description": "A name fails to clearly and honestly say what it is or does.",
"detection": "Single-letter/numbered identifiers outside tiny scopes, abbreviations not in allowlist, names <3 chars for non-loop vars. Reader judges misdescribing names.",
"determinism": "hybrid",
"aliases": [
"Bad Name"
],
"fix_hint": "Rename Variable/Field; Change Function Declaration.",
"severity_default": "info",
"languages": "all",
"sources": [
"Fowler, Refactoring 2nd ed. (2018)"
]
},
{
"id": "CS-027",
"name": "Dead Code / Unused Artifacts",
"category": "Dispensable",
"description": "Code never executed or never referenced.",
"detection": "Reachability + use-def: unreferenced privates, unused locals/params, code after return/throw, constant-false conditions. ruff F401/F841; ESLint no-unreachable.",
"determinism": "mechanical",
"aliases": [
"Unreachable Code",
"Lava Flow"
],
"fix_hint": "Remove Dead Code; enable the linter rule in CI.",
"severity_default": "warn",
"languages": "all",
"sources": [
"Fowler Remove Dead Code (2018)",
"PMD/ESLint/ruff",
"AntiPatterns Lava Flow"
]
},
{
"id": "CS-028",
"name": "High Cyclomatic Complexity",
"category": "complexity",
"description": "Too many independent linear paths through control flow.",
"detection": "Decision points +1. Flag CC>10 (warn) / >15 (fail). PMD 10; ESLint 20.",
"determinism": "mechanical",
"aliases": [
"McCabe complexity",
"CC"
],
"fix_hint": "Extract branches into named helpers; guard clauses; polymorphism.",
"severity_default": "warn",
"languages": "all imperative/OO",
"sources": [
"McCabe, IEEE TSE 1976",
"SonarQube S3776"
]
},
{
"id": "CS-029",
"name": "High Cognitive Complexity",
"category": "complexity",
"description": "Control flow hard to follow due to nesting and breaks in linear reading.",
"detection": "+1 per linear-flow break plus nesting penalty. Flag score >15.",
"determinism": "mechanical",
"aliases": [
"Sonar cognitive complexity"
],
"fix_hint": "Flatten nesting with early returns; extract nested blocks.",
"severity_default": "warn",
"languages": "all imperative/OO",
"sources": [
"Campbell, SonarSource 2017; SonarQube S3776"
]
},
{
"id": "CS-030",
"name": "High NPath Complexity",
"category": "complexity",
"description": "Excessive number of distinct acyclic execution paths.",
"detection": "Multiply path counts recursively. Flag NPath>200.",
"determinism": "mechanical",
"aliases": [
"NPATH"
],
"fix_hint": "Extract sub-methods; table/strategy dispatch.",
"severity_default": "warn",
"languages": "all imperative/OO",
"sources": [
"Nejmeh, CACM 1988; PMD NPathComplexity"
]
},
{
"id": "CS-031",
"name": "Deep Nesting",
"category": "complexity",
"description": "Control structures nested too deeply, producing arrow-shaped code.",
"detection": "Max block nesting depth >3 (PMD); ESLint max-depth 4. Flag conditions with >4 boolean operators.",
"determinism": "mechanical",
"aliases": [
"Arrow code",
"max-depth"
],
"fix_hint": "Guard clauses; extract inner blocks; lookup tables.",
"severity_default": "warn",
"languages": "all imperative/OO",
"sources": [
"PMD AvoidDeeplyNestedIfStmts; ESLint max-depth",
"arXiv:2510.03029"
]
},
{
"id": "CS-032",
"name": "Lack of Cohesion (High LCOM)",
"category": "OO-abuser / design",
"description": "Methods operate on disjoint sets of fields, bundling unrelated responsibilities.",
"detection": "LCOM(CK)>0; LCOM4 connected components >1.",
"determinism": "mechanical",
"aliases": [
"LCOM4",
"low cohesion"
],
"fix_hint": "Split the class along connected method/field clusters.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Chidamber & Kemerer 1994; Hitz & Montazeri LCOM4"
]
},
{
"id": "CS-033",
"name": "Excessive Coupling (High CBO)",
"category": "coupler",
"description": "A class depends on or is depended on by too many other classes.",
"detection": "CBO = distinct non-inheritance classes referenced. Flag >13-20; PMD 20.",
"determinism": "mechanical",
"aliases": [
"CBO",
"Tight Coupling"
],
"fix_hint": "Introduce interfaces / dependency inversion; Facade.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Chidamber & Kemerer 1994; Martin 1994"
]
},
{
"id": "CS-034",
"name": "High Fan-out / Fan-in / Hub",
"category": "coupler",
"description": "A module calls or is called by too many others, concentrating change risk.",
"detection": "Fan-out>~7, or both CA and CE in top decile (hub).",
"determinism": "mechanical",
"aliases": [
"Hub class"
],
"fix_hint": "Introduce mediating facades; split high-fan-out modules.",
"severity_default": "info",
"languages": "all",
"sources": [
"Henry & Kafura, IEEE TSE 1981",
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-035",
"name": "Too Many Methods / Fields",
"category": "bloater",
"description": "A class declares an excessive number of methods or fields.",
"detection": "PMD TooManyMethods 10; TooManyFields 15; WMC>=47.",
"determinism": "mechanical",
"aliases": [
"WMC excess"
],
"fix_hint": "Extract Class along cohesive subsets.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"PMD; Lanza & Marinescu WMC"
]
},
{
"id": "CS-036",
"name": "Too Many Branches",
"category": "complexity",
"description": "A function contains too many decision branches.",
"detection": "pylint max-branches default 12.",
"determinism": "mechanical",
"aliases": [
"R0912"
],
"fix_hint": "Extract branch groups; dispatch tables.",
"severity_default": "warn",
"languages": "Python (analogous elsewhere)",
"sources": [
"pylint R0912"
]
},
{
"id": "CS-037",
"name": "Too Many Local Variables",
"category": "bloater",
"description": "A function declares too many local variables.",
"detection": "pylint max-locals default 15.",
"determinism": "mechanical",
"aliases": [
"R0914"
],
"fix_hint": "Extract Method; group related locals into an object.",
"severity_default": "info",
"languages": "Python (analogous)",
"sources": [
"pylint R0914"
]
},
{
"id": "CS-038",
"name": "Too Many Nested Callbacks",
"category": "complexity",
"description": "Asynchronous callbacks nested too deeply.",
"detection": "ESLint max-nested-callbacks default 10 (commonly 3).",
"determinism": "mechanical",
"aliases": [
"callback hell",
"pyramid of doom"
],
"fix_hint": "Flatten with named functions, Promises, async/await.",
"severity_default": "warn",
"languages": "JS/TS",
"sources": [
"ESLint max-nested-callbacks"
]
},
{
"id": "CS-039",
"name": "High Halstead Volume / Difficulty / Effort",
"category": "complexity",
"description": "Operator/operand counts indicate large mental volume.",
"detection": "V=(N1+N2)*log2(n1+n2); D=(n1/2)*(N2/n2); E=D*V. Flag outliers.",
"determinism": "mechanical",
"aliases": [
"Halstead metrics"
],
"fix_hint": "Decompose; reduce distinct operators/operands.",
"severity_default": "info",
"languages": "all",
"sources": [
"Halstead 1977; Oman & Hagemeister 1992"
]
},
{
"id": "CS-040",
"name": "Low Maintainability Index",
"category": "complexity",
"description": "Composite of Halstead volume, CC, and LOC indicates costly maintenance.",
"detection": "MI=171-5.2lnV-0.23CC-16.2lnLOC. Flag <65 / <20.",
"determinism": "mechanical",
"aliases": [
"MI"
],
"fix_hint": "Attack the dominant driver via extraction and simplification.",
"severity_default": "info",
"languages": "all",
"sources": [
"Oman & Hagemeister 1992; radon"
]
},
{
"id": "CS-041",
"name": "Long Class File / Excessive Lines",
"category": "bloater",
"description": "A source file or class exceeds a sane line budget.",
"detection": "ESLint max-lines 300; PMD ExcessiveClassLength 1000; Checkstyle FileLength 2000.",
"determinism": "mechanical",
"aliases": [
"large file"
],
"fix_hint": "Split by responsibility; extract collaborators.",
"severity_default": "info",
"languages": "all",
"sources": [
"ESLint max-lines; PMD; Checkstyle"
]
},
{
"id": "CS-042",
"name": "Spaghetti Code",
"category": "complexity",
"description": "Tangled control flow, global state, little modularity.",
"detection": "DECOR card: high LOC, no params, global use, deep nesting, no polymorphism; CC>15-25, LOC>100, depth>5.",
"determinism": "hybrid",
"aliases": [
"Tangled control flow"
],
"fix_hint": "Restructure into cohesive methods; classes/polymorphism.",
"severity_default": "warn",
"languages": "all (esp. procedural)",
"sources": [
"AntiPatterns (1998); DECOR (Moha 2010)"
]
},
{
"id": "CS-043",
"name": "Functional Decomposition (OO antipattern)",
"category": "OO-abuser",
"description": "Procedural design forced into verb-named classes with one dominant method.",
"detection": "DECOR card: verb class name, single dominant method, globals-as-fields, near-zero polymorphism.",
"determinism": "hybrid",
"aliases": [
"procedural class",
"Verb class"
],
"fix_hint": "Redesign around cohesive objects with state+behavior.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"AntiPatterns (1998); DECOR (Moha 2010)"
]
},
{
"id": "CS-044",
"name": "Excessive Public Count / Broad API Surface",
"category": "coupler",
"description": "A class exposes too many public members.",
"detection": "PMD ExcessivePublicCount 45; high RFC.",
"determinism": "mechanical",
"aliases": [
"wide interface"
],
"fix_hint": "Narrow the public interface; split into role interfaces.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"PMD; Chidamber & Kemerer RFC"
]
},
{
"id": "CS-045",
"name": "Cyclic Dependencies",
"category": "coupler",
"description": "Modules depend on each other directly or transitively (ADP violation).",
"detection": "Import graph cycle detection (Tarjan SCC); flag SCC size >1.",
"determinism": "mechanical",
"aliases": [
"circular dependency",
"import cycle"
],
"fix_hint": "Dependency Inversion; extract shared part to a third module.",
"severity_default": "warn",
"languages": "all with modules",
"sources": [
"Martin ADP; import-linter; SonarQube"
]
},
{
"id": "CS-046",
"name": "Incomplete Abstraction",
"category": "Abstraction",
"description": "An abstraction lacks complementary methods (push but no pop).",
"detection": "Check complementary pairs (add/remove, open/close, start/stop) where only one is declared.",
"determinism": "hybrid",
"aliases": [
"Asymmetric API"
],
"fix_hint": "Add the missing complementary method(s).",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-047",
"name": "Unnecessary Abstraction",
"category": "Abstraction",
"description": "An abstraction introduced that is not actually needed.",
"detection": "Constants-only class, or a type referenced 0-1 times (no non-test callers).",
"determinism": "mechanical",
"aliases": [
"Constants-only class"
],
"fix_hint": "Inline or remove; collapse constants into using class/enum.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-048",
"name": "Deficient Encapsulation",
"category": "Encapsulation",
"description": "Member accessibility is more permissive than required.",
"detection": "Public non-final fields; public methods never called externally.",
"determinism": "mechanical",
"aliases": [
"Public fields"
],
"fix_hint": "Tighten access modifiers to the minimum required.",
"severity_default": "warn",
"languages": "OO with access modifiers",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-049",
"name": "Leaky Encapsulation",
"category": "Encapsulation",
"description": "An abstraction exposes implementation details through its interface.",
"detection": "Public getter returns a mutable internal collection without copy; internal types in signatures.",
"determinism": "mechanical",
"aliases": [
"Implementation leak"
],
"fix_hint": "Return copies/immutable views; intent-revealing operations.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-050",
"name": "Unexploited Encapsulation",
"category": "Encapsulation",
"description": "Client uses explicit type checks instead of existing polymorphism.",
"detection": "instanceof/typeof/GetType chains (>=2) over subtypes of a polymorphic hierarchy.",
"determinism": "mechanical",
"aliases": [
"instanceof chains"
],
"fix_hint": "Replace explicit type checks with a polymorphic method.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-051",
"name": "Unnecessary Hierarchy",
"category": "Hierarchy",
"description": "Inheritance applied where composition would suffice.",
"detection": "Subclasses that add/override nothing, or hierarchy used only for data variation.",
"determinism": "hybrid",
"aliases": [
"Inheritance overuse"
],
"fix_hint": "Collapse the hierarchy; composition or parameterization.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-052",
"name": "Unfactored Hierarchy",
"category": "Hierarchy",
"description": "Sibling classes share copy-pasted code that should be pulled up.",
"detection": "Clone detection scoped to siblings: near-identical bodies (>=85%) in >=2 siblings.",
"determinism": "mechanical",
"aliases": [
"Sibling duplication"
],
"fix_hint": "Pull duplicated members up to the superclass.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-053",
"name": "Wide Hierarchy",
"category": "Hierarchy",
"description": "An inheritance hierarchy is too wide.",
"detection": "NOC above threshold (e.g. >10) where subgroups share features.",
"determinism": "mechanical",
"aliases": [
"Excessive breadth"
],
"fix_hint": "Introduce intermediate abstractions.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-054",
"name": "Deep Hierarchy",
"category": "Hierarchy",
"description": "An inheritance hierarchy is excessively deep.",
"detection": "DIT above threshold (e.g. >5 for non-framework code).",
"determinism": "mechanical",
"aliases": [
"High DIT",
"Yo-yo problem"
],
"fix_hint": "Flatten; favor composition over deep inheritance.",
"severity_default": "info",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014); Chidamber & Kemerer DIT"
]
},
{
"id": "CS-055",
"name": "Broken Hierarchy",
"category": "Hierarchy",
"description": "Supertype and subtype do not share an is-a relationship.",
"detection": "Subtype shares no client-facing behavior and is never used polymorphically. Requires reader judgment on is-a.",
"determinism": "bounded-reader",
"aliases": [
"No is-a relation"
],
"fix_hint": "Replace inheritance with composition/delegation.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-056",
"name": "Multipath Hierarchy",
"category": "Hierarchy",
"description": "A subtype inherits both directly and indirectly from a supertype (diamond).",
"detection": "Supertype reachable from a subtype via >=2 distinct paths in the inheritance DAG.",
"determinism": "mechanical",
"aliases": [
"Diamond problem"
],
"fix_hint": "Single inheritance path; interfaces or composition.",
"severity_default": "info",
"languages": "C++, Python, Eiffel; multiple default methods",
"sources": [
"Suryanarayana et al. (2014)"
]
},
{
"id": "CS-057",
"name": "Cyclic Hierarchy",
"category": "Hierarchy",
"description": "A supertype depends on one of its subtypes.",
"detection": "Reference from a base type to any descendant type (base->derived edge).",
"determinism": "mechanical",
"aliases": [
"Supertype depends on subtype"
],
"fix_hint": "Invert the dependency; introduce an abstraction/callback.",
"severity_default": "warn",
"languages": "OO languages",
"sources": [
"Suryanarayana et al. (2014)"