moderne-visualizations-misc 0.71.2__py3-none-any.whl → 0.73.0__py3-none-any.whl

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.
@@ -0,0 +1,2041 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "tags": [
8
+ "parameters"
9
+ ]
10
+ },
11
+ "outputs": [],
12
+ "source": [
13
+ "repository_filter: list[str] = []\n",
14
+ "complexity_threshold: int = 10"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 2,
20
+ "metadata": {},
21
+ "outputs": [
22
+ {
23
+ "data": {
24
+ "application/vnd.plotly.v1+json": {
25
+ "config": {
26
+ "plotlyServerURL": "https://plot.ly"
27
+ },
28
+ "data": [
29
+ {
30
+ "customdata": [
31
+ [
32
+ 7,
33
+ 1
34
+ ],
35
+ [
36
+ 169,
37
+ 21
38
+ ],
39
+ [
40
+ 552,
41
+ 91
42
+ ],
43
+ [
44
+ 5560,
45
+ 540
46
+ ],
47
+ [
48
+ 114,
49
+ 16
50
+ ],
51
+ [
52
+ 16,
53
+ 8
54
+ ],
55
+ [
56
+ 140,
57
+ 15
58
+ ],
59
+ [
60
+ 8345,
61
+ 1403
62
+ ],
63
+ [
64
+ 192,
65
+ 40
66
+ ],
67
+ [
68
+ 2781,
69
+ 467
70
+ ],
71
+ [
72
+ 2762,
73
+ 496
74
+ ],
75
+ [
76
+ 2371,
77
+ 384
78
+ ],
79
+ [
80
+ 158,
81
+ 30
82
+ ],
83
+ [
84
+ 3,
85
+ 1
86
+ ],
87
+ [
88
+ 1721,
89
+ 284
90
+ ],
91
+ [
92
+ 284,
93
+ 80
94
+ ],
95
+ [
96
+ 147,
97
+ 34
98
+ ],
99
+ [
100
+ 3051,
101
+ 514
102
+ ],
103
+ [
104
+ 3343,
105
+ 266
106
+ ],
107
+ [
108
+ 512,
109
+ 48
110
+ ],
111
+ [
112
+ 1028,
113
+ 88
114
+ ],
115
+ [
116
+ 278,
117
+ 35
118
+ ],
119
+ [
120
+ 5120,
121
+ 978
122
+ ],
123
+ [
124
+ 1320,
125
+ 200
126
+ ],
127
+ [
128
+ 1610,
129
+ 344
130
+ ],
131
+ [
132
+ 1269,
133
+ 222
134
+ ],
135
+ [
136
+ 1566,
137
+ 288
138
+ ],
139
+ [
140
+ 615,
141
+ 153
142
+ ],
143
+ [
144
+ 653,
145
+ 202
146
+ ],
147
+ [
148
+ 11,
149
+ 4
150
+ ],
151
+ [
152
+ 10,
153
+ 3
154
+ ],
155
+ [
156
+ 10,
157
+ 3
158
+ ],
159
+ [
160
+ 15,
161
+ 3
162
+ ],
163
+ [
164
+ 9,
165
+ 6
166
+ ],
167
+ [
168
+ 8,
169
+ 4
170
+ ],
171
+ [
172
+ 13,
173
+ 5
174
+ ],
175
+ [
176
+ 9,
177
+ 9
178
+ ],
179
+ [
180
+ 45,
181
+ 8
182
+ ],
183
+ [
184
+ 9,
185
+ 6
186
+ ],
187
+ [
188
+ 11,
189
+ 5
190
+ ],
191
+ [
192
+ 4,
193
+ 3
194
+ ],
195
+ [
196
+ 8,
197
+ 4
198
+ ],
199
+ [
200
+ 8,
201
+ 2
202
+ ],
203
+ [
204
+ 13,
205
+ 9
206
+ ],
207
+ [
208
+ 8,
209
+ 6
210
+ ],
211
+ [
212
+ 6,
213
+ 4
214
+ ],
215
+ [
216
+ 4,
217
+ 4
218
+ ],
219
+ [
220
+ 7,
221
+ 4
222
+ ],
223
+ [
224
+ 4,
225
+ 3
226
+ ],
227
+ [
228
+ 6,
229
+ 2
230
+ ],
231
+ [
232
+ 12,
233
+ 9
234
+ ],
235
+ [
236
+ 8,
237
+ 3
238
+ ],
239
+ [
240
+ 5,
241
+ 3
242
+ ],
243
+ [
244
+ 6,
245
+ 4
246
+ ],
247
+ [
248
+ 47,
249
+ 9
250
+ ],
251
+ [
252
+ 16,
253
+ 5
254
+ ],
255
+ [
256
+ 9,
257
+ 3
258
+ ],
259
+ [
260
+ 7,
261
+ 4
262
+ ],
263
+ [
264
+ 114,
265
+ 12
266
+ ],
267
+ [
268
+ 186,
269
+ 19
270
+ ],
271
+ [
272
+ 31,
273
+ 5
274
+ ],
275
+ [
276
+ 780,
277
+ 206
278
+ ],
279
+ [
280
+ 277,
281
+ 74
282
+ ],
283
+ [
284
+ 63,
285
+ 13
286
+ ],
287
+ [
288
+ 63,
289
+ 20
290
+ ],
291
+ [
292
+ 193,
293
+ 46
294
+ ],
295
+ [
296
+ 3900,
297
+ 621
298
+ ],
299
+ [
300
+ 11022,
301
+ 1950
302
+ ],
303
+ [
304
+ 725,
305
+ 156
306
+ ],
307
+ [
308
+ 487,
309
+ 152
310
+ ],
311
+ [
312
+ 6782,
313
+ 959
314
+ ],
315
+ [
316
+ 808,
317
+ 128
318
+ ],
319
+ [
320
+ 317,
321
+ 70
322
+ ],
323
+ [
324
+ 13121,
325
+ 1188
326
+ ],
327
+ [
328
+ 7060,
329
+ 1273
330
+ ],
331
+ [
332
+ 1286,
333
+ 243
334
+ ],
335
+ [
336
+ 81251,
337
+ 13132
338
+ ],
339
+ [
340
+ 3023,
341
+ 525
342
+ ],
343
+ [
344
+ 130,
345
+ 33
346
+ ],
347
+ [
348
+ 907,
349
+ 283
350
+ ],
351
+ [
352
+ 4202,
353
+ 612
354
+ ],
355
+ [
356
+ 164,
357
+ 41
358
+ ],
359
+ [
360
+ 2287,
361
+ 378
362
+ ],
363
+ [
364
+ 1592,
365
+ 222
366
+ ],
367
+ [
368
+ 241,
369
+ 57
370
+ ],
371
+ [
372
+ 3225,
373
+ 526
374
+ ],
375
+ [
376
+ 274,
377
+ 28
378
+ ],
379
+ [
380
+ 212,
381
+ 52
382
+ ]
383
+ ],
384
+ "hovertemplate": "<b>%{text}</b><br>Average Complexity: %{y:.2f}<br>High Complexity Methods: %{x}<br>Total Methods: %{customdata[0]}<br>Number of Classes: %{customdata[1]}<extra></extra>",
385
+ "marker": {
386
+ "color": [
387
+ 0,
388
+ 5,
389
+ 1,
390
+ 59,
391
+ 0,
392
+ 0,
393
+ 3,
394
+ 202,
395
+ 4,
396
+ 90,
397
+ 75,
398
+ 31,
399
+ 3,
400
+ 0,
401
+ 2,
402
+ 1,
403
+ 0,
404
+ 32,
405
+ 32,
406
+ 6,
407
+ 8,
408
+ 4,
409
+ 18,
410
+ 5,
411
+ 10,
412
+ 21,
413
+ 7,
414
+ 1,
415
+ 1,
416
+ 0,
417
+ 0,
418
+ 0,
419
+ 0,
420
+ 0,
421
+ 0,
422
+ 0,
423
+ 0,
424
+ 0,
425
+ 0,
426
+ 0,
427
+ 0,
428
+ 0,
429
+ 0,
430
+ 0,
431
+ 0,
432
+ 0,
433
+ 0,
434
+ 0,
435
+ 0,
436
+ 0,
437
+ 0,
438
+ 0,
439
+ 0,
440
+ 0,
441
+ 0,
442
+ 0,
443
+ 0,
444
+ 0,
445
+ 0,
446
+ 0,
447
+ 0,
448
+ 0,
449
+ 2,
450
+ 1,
451
+ 0,
452
+ 0,
453
+ 42,
454
+ 84,
455
+ 5,
456
+ 2,
457
+ 48,
458
+ 3,
459
+ 3,
460
+ 34,
461
+ 34,
462
+ 3,
463
+ 844,
464
+ 13,
465
+ 1,
466
+ 8,
467
+ 35,
468
+ 1,
469
+ 3,
470
+ 0,
471
+ 0,
472
+ 12,
473
+ 0,
474
+ 0
475
+ ],
476
+ "colorbar": {
477
+ "len": 0.7,
478
+ "thickness": 15,
479
+ "title": {
480
+ "text": "High Complexity<br>Methods"
481
+ }
482
+ },
483
+ "colorscale": [
484
+ [
485
+ 0,
486
+ "rgb(255,255,204)"
487
+ ],
488
+ [
489
+ 0.125,
490
+ "rgb(255,237,160)"
491
+ ],
492
+ [
493
+ 0.25,
494
+ "rgb(254,217,118)"
495
+ ],
496
+ [
497
+ 0.375,
498
+ "rgb(254,178,76)"
499
+ ],
500
+ [
501
+ 0.5,
502
+ "rgb(253,141,60)"
503
+ ],
504
+ [
505
+ 0.625,
506
+ "rgb(252,78,42)"
507
+ ],
508
+ [
509
+ 0.75,
510
+ "rgb(227,26,28)"
511
+ ],
512
+ [
513
+ 0.875,
514
+ "rgb(189,0,38)"
515
+ ],
516
+ [
517
+ 1,
518
+ "rgb(128,0,38)"
519
+ ]
520
+ ],
521
+ "showscale": true,
522
+ "size": [
523
+ 1,
524
+ 21,
525
+ 91,
526
+ 540,
527
+ 16,
528
+ 8,
529
+ 15,
530
+ 1403,
531
+ 40,
532
+ 467,
533
+ 496,
534
+ 384,
535
+ 30,
536
+ 1,
537
+ 284,
538
+ 80,
539
+ 34,
540
+ 514,
541
+ 266,
542
+ 48,
543
+ 88,
544
+ 35,
545
+ 978,
546
+ 200,
547
+ 344,
548
+ 222,
549
+ 288,
550
+ 153,
551
+ 202,
552
+ 4,
553
+ 3,
554
+ 3,
555
+ 3,
556
+ 6,
557
+ 4,
558
+ 5,
559
+ 9,
560
+ 8,
561
+ 6,
562
+ 5,
563
+ 3,
564
+ 4,
565
+ 2,
566
+ 9,
567
+ 6,
568
+ 4,
569
+ 4,
570
+ 4,
571
+ 3,
572
+ 2,
573
+ 9,
574
+ 3,
575
+ 3,
576
+ 4,
577
+ 9,
578
+ 5,
579
+ 3,
580
+ 4,
581
+ 12,
582
+ 19,
583
+ 5,
584
+ 206,
585
+ 74,
586
+ 13,
587
+ 20,
588
+ 46,
589
+ 621,
590
+ 1950,
591
+ 156,
592
+ 152,
593
+ 959,
594
+ 128,
595
+ 70,
596
+ 1188,
597
+ 1273,
598
+ 243,
599
+ 13132,
600
+ 525,
601
+ 33,
602
+ 283,
603
+ 612,
604
+ 41,
605
+ 378,
606
+ 222,
607
+ 57,
608
+ 526,
609
+ 28,
610
+ 52
611
+ ],
612
+ "sizemin": 4,
613
+ "sizemode": "area",
614
+ "sizeref": 2.6264
615
+ },
616
+ "mode": "markers",
617
+ "text": [
618
+ "Netflix/awsobjectmapper",
619
+ "Netflix/blitz4j",
620
+ "Netflix/concurrency-limits",
621
+ "Netflix/conductor",
622
+ "Netflix/curator",
623
+ "Netflix/dgs-codegen",
624
+ "Netflix/frigga",
625
+ "Netflix/hollow",
626
+ "Netflix/mantis-api",
627
+ "Netflix/metacat",
628
+ "Netflix/photon",
629
+ "Netflix/zuul",
630
+ "nebula-plugins/nebula-dependency-recommender",
631
+ "nebula-plugins/nebula-release-plugin",
632
+ "spring-cloud/spring-cloud-app-broker",
633
+ "spring-cloud/spring-cloud-bindings",
634
+ "spring-cloud/spring-cloud-cloudfoundry",
635
+ "spring-cloud/spring-cloud-config",
636
+ "spring-cloud/spring-cloud-deployer",
637
+ "spring-cloud/spring-cloud-deployer-cloudfoundry",
638
+ "spring-cloud/spring-cloud-deployer-kubernetes",
639
+ "spring-cloud/spring-cloud-deployer-local",
640
+ "spring-cloud/spring-cloud-gateway",
641
+ "spring-cloud/spring-cloud-netflix",
642
+ "spring-cloud/spring-cloud-openfeign",
643
+ "spring-cloud/spring-cloud-stream-binder-kafka",
644
+ "spring-cloud/spring-cloud-task",
645
+ "spring-cloud/spring-cloud-zookeeper",
646
+ "spring-cloud/stream-applications",
647
+ "spring-guides/gs-accessing-data-jpa",
648
+ "spring-guides/gs-accessing-data-neo4j",
649
+ "spring-guides/gs-accessing-gemfire-data-rest",
650
+ "spring-guides/gs-accessing-neo4j-data-rest",
651
+ "spring-guides/gs-actuator-service",
652
+ "spring-guides/gs-authenticating-ldap",
653
+ "spring-guides/gs-batch-processing",
654
+ "spring-guides/gs-centralized-configuration",
655
+ "spring-guides/gs-crud-with-vaadin",
656
+ "spring-guides/gs-graphql-server",
657
+ "spring-guides/gs-handling-form-submission",
658
+ "spring-guides/gs-integration",
659
+ "spring-guides/gs-managing-transactions",
660
+ "spring-guides/gs-messaging-redis",
661
+ "spring-guides/gs-multi-module",
662
+ "spring-guides/gs-rest-hateoas",
663
+ "spring-guides/gs-rest-service",
664
+ "spring-guides/gs-scheduling-tasks",
665
+ "spring-guides/gs-serving-web-content",
666
+ "spring-guides/gs-spring-boot-for-azure",
667
+ "spring-guides/gs-spring-boot-kubernetes",
668
+ "spring-guides/gs-spring-cloud-stream",
669
+ "spring-guides/gs-spring-cloud-task",
670
+ "spring-guides/gs-tanzu-observability",
671
+ "spring-guides/gs-testing-restdocs",
672
+ "spring-guides/gs-uploading-files",
673
+ "spring-guides/gs-validating-form-input",
674
+ "spring-guides/gs-vault-config",
675
+ "spring-guides/top-spring-on-kubernetes",
676
+ "spring-guides/tut-rest",
677
+ "spring-guides/tut-spring-security-and-angular-js",
678
+ "spring-projects-experimental/spring-batch-experimental",
679
+ "spring-projects-experimental/spring-cloud-sleuth-otel",
680
+ "spring-projects-experimental/spring-cloud-square",
681
+ "spring-projects-experimental/spring-openapi-aggregator",
682
+ "spring-projects-experimental/spring-retrosocket",
683
+ "spring-projects/spring-amqp-samples",
684
+ "spring-projects/spring-authorization-server",
685
+ "spring-projects/spring-batch",
686
+ "spring-projects/spring-batch-extensions",
687
+ "spring-projects/spring-checkpoint-restore-smoke-tests",
688
+ "spring-projects/spring-data-elasticsearch",
689
+ "spring-projects/spring-data-keyvalue",
690
+ "spring-projects/spring-data-ldap",
691
+ "spring-projects/spring-data-redis",
692
+ "spring-projects/spring-data-relational",
693
+ "spring-projects/spring-data-release",
694
+ "spring-projects/spring-framework",
695
+ "spring-projects/spring-hateoas",
696
+ "spring-projects/spring-hateoas-examples",
697
+ "spring-projects/spring-integration-samples",
698
+ "spring-projects/spring-ldap",
699
+ "spring-projects/spring-petclinic",
700
+ "spring-projects/spring-restdocs",
701
+ "spring-projects/spring-session-data-geode",
702
+ "spring-projects/spring-session-data-mongodb",
703
+ "spring-projects/spring-vault",
704
+ "spring-projects/spring-webflow-samples",
705
+ "spring-projects/spring-ws-samples"
706
+ ],
707
+ "type": "scatter",
708
+ "x": [
709
+ 0,
710
+ 5,
711
+ 1,
712
+ 59,
713
+ 0,
714
+ 0,
715
+ 3,
716
+ 202,
717
+ 4,
718
+ 90,
719
+ 75,
720
+ 31,
721
+ 3,
722
+ 0,
723
+ 2,
724
+ 1,
725
+ 0,
726
+ 32,
727
+ 32,
728
+ 6,
729
+ 8,
730
+ 4,
731
+ 18,
732
+ 5,
733
+ 10,
734
+ 21,
735
+ 7,
736
+ 1,
737
+ 1,
738
+ 0,
739
+ 0,
740
+ 0,
741
+ 0,
742
+ 0,
743
+ 0,
744
+ 0,
745
+ 0,
746
+ 0,
747
+ 0,
748
+ 0,
749
+ 0,
750
+ 0,
751
+ 0,
752
+ 0,
753
+ 0,
754
+ 0,
755
+ 0,
756
+ 0,
757
+ 0,
758
+ 0,
759
+ 0,
760
+ 0,
761
+ 0,
762
+ 0,
763
+ 0,
764
+ 0,
765
+ 0,
766
+ 0,
767
+ 0,
768
+ 0,
769
+ 0,
770
+ 0,
771
+ 2,
772
+ 1,
773
+ 0,
774
+ 0,
775
+ 42,
776
+ 84,
777
+ 5,
778
+ 2,
779
+ 48,
780
+ 3,
781
+ 3,
782
+ 34,
783
+ 34,
784
+ 3,
785
+ 844,
786
+ 13,
787
+ 1,
788
+ 8,
789
+ 35,
790
+ 1,
791
+ 3,
792
+ 0,
793
+ 0,
794
+ 12,
795
+ 0,
796
+ 0
797
+ ],
798
+ "y": [
799
+ 2.4285714285714284,
800
+ 2.5384615384615383,
801
+ 1.3442028985507246,
802
+ 1.5562949640287769,
803
+ 1.7017543859649122,
804
+ 1,
805
+ 2.1,
806
+ 2.0357100059916116,
807
+ 2.1145833333333335,
808
+ 2.304566702624955,
809
+ 2.223388848660391,
810
+ 1.6836777730915227,
811
+ 2.0126582278481013,
812
+ 3,
813
+ 1.1528181289947705,
814
+ 1.369718309859155,
815
+ 1.1768707482993197,
816
+ 1.4664044575549,
817
+ 1.5949745737361651,
818
+ 1.85546875,
819
+ 1.6070038910505837,
820
+ 1.9388489208633093,
821
+ 1.31328125,
822
+ 1.412121212121212,
823
+ 1.3931677018633541,
824
+ 1.7880220646178093,
825
+ 1.3397190293742018,
826
+ 1.4292682926829268,
827
+ 1.310872894333844,
828
+ 1,
829
+ 1.1,
830
+ 1,
831
+ 1,
832
+ 1,
833
+ 1,
834
+ 1.0769230769230769,
835
+ 1,
836
+ 1.0666666666666667,
837
+ 1,
838
+ 1,
839
+ 1,
840
+ 1.625,
841
+ 1.125,
842
+ 1,
843
+ 1,
844
+ 1,
845
+ 1,
846
+ 1,
847
+ 1,
848
+ 1,
849
+ 1,
850
+ 1,
851
+ 1,
852
+ 1,
853
+ 1.3829787234042554,
854
+ 1.0625,
855
+ 1,
856
+ 1,
857
+ 1.219298245614035,
858
+ 1.1021505376344085,
859
+ 1.4193548387096775,
860
+ 1.2717948717948717,
861
+ 1.4657039711191335,
862
+ 2.0317460317460316,
863
+ 1.4285714285714286,
864
+ 1.1036269430051813,
865
+ 1.4692307692307693,
866
+ 1.426238432226456,
867
+ 1.3917241379310346,
868
+ 1.213552361396304,
869
+ 1.317605426127986,
870
+ 1.2574257425742574,
871
+ 1.6340694006309149,
872
+ 1.2524959987805808,
873
+ 1.3879603399433427,
874
+ 1.5396578538102643,
875
+ 1.5713529679634712,
876
+ 1.3691696989745286,
877
+ 1.2230769230769232,
878
+ 1.4785005512679161,
879
+ 1.5235602094240839,
880
+ 1.4085365853658536,
881
+ 1.2955837341495409,
882
+ 1.129396984924623,
883
+ 1.2365145228215768,
884
+ 1.3786046511627907,
885
+ 1.1788321167883211,
886
+ 1.330188679245283
887
+ ]
888
+ }
889
+ ],
890
+ "layout": {
891
+ "annotations": [
892
+ {
893
+ "bgcolor": "rgba(255,0,0,0.1)",
894
+ "borderpad": 4,
895
+ "font": {
896
+ "size": 10
897
+ },
898
+ "showarrow": false,
899
+ "text": "<b>High Risk</b><br>Many complex methods",
900
+ "x": 0.95,
901
+ "xref": "paper",
902
+ "y": 0.95,
903
+ "yref": "paper"
904
+ },
905
+ {
906
+ "bgcolor": "rgba(255,165,0,0.1)",
907
+ "borderpad": 4,
908
+ "font": {
909
+ "size": 10
910
+ },
911
+ "showarrow": false,
912
+ "text": "<b>Systemic</b><br>Pervasive complexity",
913
+ "x": 0.05,
914
+ "xref": "paper",
915
+ "y": 0.95,
916
+ "yref": "paper"
917
+ },
918
+ {
919
+ "bgcolor": "rgba(255,255,0,0.1)",
920
+ "borderpad": 4,
921
+ "font": {
922
+ "size": 10
923
+ },
924
+ "showarrow": false,
925
+ "text": "<b>Localized</b><br>Few problem areas",
926
+ "x": 0.95,
927
+ "xref": "paper",
928
+ "y": 0.05,
929
+ "yref": "paper"
930
+ },
931
+ {
932
+ "bgcolor": "rgba(0,255,0,0.1)",
933
+ "borderpad": 4,
934
+ "font": {
935
+ "size": 10
936
+ },
937
+ "showarrow": false,
938
+ "text": "<b>Low Risk</b><br>Well-maintained",
939
+ "x": 0.05,
940
+ "xref": "paper",
941
+ "y": 0.05,
942
+ "yref": "paper"
943
+ }
944
+ ],
945
+ "hovermode": "closest",
946
+ "margin": {
947
+ "b": 60,
948
+ "l": 60,
949
+ "r": 120,
950
+ "t": 100
951
+ },
952
+ "plot_bgcolor": "white",
953
+ "shapes": [
954
+ {
955
+ "line": {
956
+ "color": "gray",
957
+ "dash": "dash"
958
+ },
959
+ "opacity": 0.5,
960
+ "type": "line",
961
+ "x0": 0.5,
962
+ "x1": 0.5,
963
+ "xref": "x",
964
+ "y0": 0,
965
+ "y1": 1,
966
+ "yref": "y domain"
967
+ },
968
+ {
969
+ "line": {
970
+ "color": "gray",
971
+ "dash": "dash"
972
+ },
973
+ "opacity": 0.5,
974
+ "type": "line",
975
+ "x0": 0,
976
+ "x1": 1,
977
+ "xref": "x domain",
978
+ "y0": 1.315443338063993,
979
+ "y1": 1.315443338063993,
980
+ "yref": "y"
981
+ }
982
+ ],
983
+ "template": {
984
+ "data": {
985
+ "bar": [
986
+ {
987
+ "error_x": {
988
+ "color": "#2a3f5f"
989
+ },
990
+ "error_y": {
991
+ "color": "#2a3f5f"
992
+ },
993
+ "marker": {
994
+ "line": {
995
+ "color": "#E5ECF6",
996
+ "width": 0.5
997
+ },
998
+ "pattern": {
999
+ "fillmode": "overlay",
1000
+ "size": 10,
1001
+ "solidity": 0.2
1002
+ }
1003
+ },
1004
+ "type": "bar"
1005
+ }
1006
+ ],
1007
+ "barpolar": [
1008
+ {
1009
+ "marker": {
1010
+ "line": {
1011
+ "color": "#E5ECF6",
1012
+ "width": 0.5
1013
+ },
1014
+ "pattern": {
1015
+ "fillmode": "overlay",
1016
+ "size": 10,
1017
+ "solidity": 0.2
1018
+ }
1019
+ },
1020
+ "type": "barpolar"
1021
+ }
1022
+ ],
1023
+ "carpet": [
1024
+ {
1025
+ "aaxis": {
1026
+ "endlinecolor": "#2a3f5f",
1027
+ "gridcolor": "white",
1028
+ "linecolor": "white",
1029
+ "minorgridcolor": "white",
1030
+ "startlinecolor": "#2a3f5f"
1031
+ },
1032
+ "baxis": {
1033
+ "endlinecolor": "#2a3f5f",
1034
+ "gridcolor": "white",
1035
+ "linecolor": "white",
1036
+ "minorgridcolor": "white",
1037
+ "startlinecolor": "#2a3f5f"
1038
+ },
1039
+ "type": "carpet"
1040
+ }
1041
+ ],
1042
+ "choropleth": [
1043
+ {
1044
+ "colorbar": {
1045
+ "outlinewidth": 0,
1046
+ "ticks": ""
1047
+ },
1048
+ "type": "choropleth"
1049
+ }
1050
+ ],
1051
+ "contour": [
1052
+ {
1053
+ "colorbar": {
1054
+ "outlinewidth": 0,
1055
+ "ticks": ""
1056
+ },
1057
+ "colorscale": [
1058
+ [
1059
+ 0,
1060
+ "#0d0887"
1061
+ ],
1062
+ [
1063
+ 0.1111111111111111,
1064
+ "#46039f"
1065
+ ],
1066
+ [
1067
+ 0.2222222222222222,
1068
+ "#7201a8"
1069
+ ],
1070
+ [
1071
+ 0.3333333333333333,
1072
+ "#9c179e"
1073
+ ],
1074
+ [
1075
+ 0.4444444444444444,
1076
+ "#bd3786"
1077
+ ],
1078
+ [
1079
+ 0.5555555555555556,
1080
+ "#d8576b"
1081
+ ],
1082
+ [
1083
+ 0.6666666666666666,
1084
+ "#ed7953"
1085
+ ],
1086
+ [
1087
+ 0.7777777777777778,
1088
+ "#fb9f3a"
1089
+ ],
1090
+ [
1091
+ 0.8888888888888888,
1092
+ "#fdca26"
1093
+ ],
1094
+ [
1095
+ 1,
1096
+ "#f0f921"
1097
+ ]
1098
+ ],
1099
+ "type": "contour"
1100
+ }
1101
+ ],
1102
+ "contourcarpet": [
1103
+ {
1104
+ "colorbar": {
1105
+ "outlinewidth": 0,
1106
+ "ticks": ""
1107
+ },
1108
+ "type": "contourcarpet"
1109
+ }
1110
+ ],
1111
+ "heatmap": [
1112
+ {
1113
+ "colorbar": {
1114
+ "outlinewidth": 0,
1115
+ "ticks": ""
1116
+ },
1117
+ "colorscale": [
1118
+ [
1119
+ 0,
1120
+ "#0d0887"
1121
+ ],
1122
+ [
1123
+ 0.1111111111111111,
1124
+ "#46039f"
1125
+ ],
1126
+ [
1127
+ 0.2222222222222222,
1128
+ "#7201a8"
1129
+ ],
1130
+ [
1131
+ 0.3333333333333333,
1132
+ "#9c179e"
1133
+ ],
1134
+ [
1135
+ 0.4444444444444444,
1136
+ "#bd3786"
1137
+ ],
1138
+ [
1139
+ 0.5555555555555556,
1140
+ "#d8576b"
1141
+ ],
1142
+ [
1143
+ 0.6666666666666666,
1144
+ "#ed7953"
1145
+ ],
1146
+ [
1147
+ 0.7777777777777778,
1148
+ "#fb9f3a"
1149
+ ],
1150
+ [
1151
+ 0.8888888888888888,
1152
+ "#fdca26"
1153
+ ],
1154
+ [
1155
+ 1,
1156
+ "#f0f921"
1157
+ ]
1158
+ ],
1159
+ "type": "heatmap"
1160
+ }
1161
+ ],
1162
+ "heatmapgl": [
1163
+ {
1164
+ "colorbar": {
1165
+ "outlinewidth": 0,
1166
+ "ticks": ""
1167
+ },
1168
+ "colorscale": [
1169
+ [
1170
+ 0,
1171
+ "#0d0887"
1172
+ ],
1173
+ [
1174
+ 0.1111111111111111,
1175
+ "#46039f"
1176
+ ],
1177
+ [
1178
+ 0.2222222222222222,
1179
+ "#7201a8"
1180
+ ],
1181
+ [
1182
+ 0.3333333333333333,
1183
+ "#9c179e"
1184
+ ],
1185
+ [
1186
+ 0.4444444444444444,
1187
+ "#bd3786"
1188
+ ],
1189
+ [
1190
+ 0.5555555555555556,
1191
+ "#d8576b"
1192
+ ],
1193
+ [
1194
+ 0.6666666666666666,
1195
+ "#ed7953"
1196
+ ],
1197
+ [
1198
+ 0.7777777777777778,
1199
+ "#fb9f3a"
1200
+ ],
1201
+ [
1202
+ 0.8888888888888888,
1203
+ "#fdca26"
1204
+ ],
1205
+ [
1206
+ 1,
1207
+ "#f0f921"
1208
+ ]
1209
+ ],
1210
+ "type": "heatmapgl"
1211
+ }
1212
+ ],
1213
+ "histogram": [
1214
+ {
1215
+ "marker": {
1216
+ "pattern": {
1217
+ "fillmode": "overlay",
1218
+ "size": 10,
1219
+ "solidity": 0.2
1220
+ }
1221
+ },
1222
+ "type": "histogram"
1223
+ }
1224
+ ],
1225
+ "histogram2d": [
1226
+ {
1227
+ "colorbar": {
1228
+ "outlinewidth": 0,
1229
+ "ticks": ""
1230
+ },
1231
+ "colorscale": [
1232
+ [
1233
+ 0,
1234
+ "#0d0887"
1235
+ ],
1236
+ [
1237
+ 0.1111111111111111,
1238
+ "#46039f"
1239
+ ],
1240
+ [
1241
+ 0.2222222222222222,
1242
+ "#7201a8"
1243
+ ],
1244
+ [
1245
+ 0.3333333333333333,
1246
+ "#9c179e"
1247
+ ],
1248
+ [
1249
+ 0.4444444444444444,
1250
+ "#bd3786"
1251
+ ],
1252
+ [
1253
+ 0.5555555555555556,
1254
+ "#d8576b"
1255
+ ],
1256
+ [
1257
+ 0.6666666666666666,
1258
+ "#ed7953"
1259
+ ],
1260
+ [
1261
+ 0.7777777777777778,
1262
+ "#fb9f3a"
1263
+ ],
1264
+ [
1265
+ 0.8888888888888888,
1266
+ "#fdca26"
1267
+ ],
1268
+ [
1269
+ 1,
1270
+ "#f0f921"
1271
+ ]
1272
+ ],
1273
+ "type": "histogram2d"
1274
+ }
1275
+ ],
1276
+ "histogram2dcontour": [
1277
+ {
1278
+ "colorbar": {
1279
+ "outlinewidth": 0,
1280
+ "ticks": ""
1281
+ },
1282
+ "colorscale": [
1283
+ [
1284
+ 0,
1285
+ "#0d0887"
1286
+ ],
1287
+ [
1288
+ 0.1111111111111111,
1289
+ "#46039f"
1290
+ ],
1291
+ [
1292
+ 0.2222222222222222,
1293
+ "#7201a8"
1294
+ ],
1295
+ [
1296
+ 0.3333333333333333,
1297
+ "#9c179e"
1298
+ ],
1299
+ [
1300
+ 0.4444444444444444,
1301
+ "#bd3786"
1302
+ ],
1303
+ [
1304
+ 0.5555555555555556,
1305
+ "#d8576b"
1306
+ ],
1307
+ [
1308
+ 0.6666666666666666,
1309
+ "#ed7953"
1310
+ ],
1311
+ [
1312
+ 0.7777777777777778,
1313
+ "#fb9f3a"
1314
+ ],
1315
+ [
1316
+ 0.8888888888888888,
1317
+ "#fdca26"
1318
+ ],
1319
+ [
1320
+ 1,
1321
+ "#f0f921"
1322
+ ]
1323
+ ],
1324
+ "type": "histogram2dcontour"
1325
+ }
1326
+ ],
1327
+ "mesh3d": [
1328
+ {
1329
+ "colorbar": {
1330
+ "outlinewidth": 0,
1331
+ "ticks": ""
1332
+ },
1333
+ "type": "mesh3d"
1334
+ }
1335
+ ],
1336
+ "parcoords": [
1337
+ {
1338
+ "line": {
1339
+ "colorbar": {
1340
+ "outlinewidth": 0,
1341
+ "ticks": ""
1342
+ }
1343
+ },
1344
+ "type": "parcoords"
1345
+ }
1346
+ ],
1347
+ "pie": [
1348
+ {
1349
+ "automargin": true,
1350
+ "type": "pie"
1351
+ }
1352
+ ],
1353
+ "scatter": [
1354
+ {
1355
+ "fillpattern": {
1356
+ "fillmode": "overlay",
1357
+ "size": 10,
1358
+ "solidity": 0.2
1359
+ },
1360
+ "type": "scatter"
1361
+ }
1362
+ ],
1363
+ "scatter3d": [
1364
+ {
1365
+ "line": {
1366
+ "colorbar": {
1367
+ "outlinewidth": 0,
1368
+ "ticks": ""
1369
+ }
1370
+ },
1371
+ "marker": {
1372
+ "colorbar": {
1373
+ "outlinewidth": 0,
1374
+ "ticks": ""
1375
+ }
1376
+ },
1377
+ "type": "scatter3d"
1378
+ }
1379
+ ],
1380
+ "scattercarpet": [
1381
+ {
1382
+ "marker": {
1383
+ "colorbar": {
1384
+ "outlinewidth": 0,
1385
+ "ticks": ""
1386
+ }
1387
+ },
1388
+ "type": "scattercarpet"
1389
+ }
1390
+ ],
1391
+ "scattergeo": [
1392
+ {
1393
+ "marker": {
1394
+ "colorbar": {
1395
+ "outlinewidth": 0,
1396
+ "ticks": ""
1397
+ }
1398
+ },
1399
+ "type": "scattergeo"
1400
+ }
1401
+ ],
1402
+ "scattergl": [
1403
+ {
1404
+ "marker": {
1405
+ "colorbar": {
1406
+ "outlinewidth": 0,
1407
+ "ticks": ""
1408
+ }
1409
+ },
1410
+ "type": "scattergl"
1411
+ }
1412
+ ],
1413
+ "scattermapbox": [
1414
+ {
1415
+ "marker": {
1416
+ "colorbar": {
1417
+ "outlinewidth": 0,
1418
+ "ticks": ""
1419
+ }
1420
+ },
1421
+ "type": "scattermapbox"
1422
+ }
1423
+ ],
1424
+ "scatterpolar": [
1425
+ {
1426
+ "marker": {
1427
+ "colorbar": {
1428
+ "outlinewidth": 0,
1429
+ "ticks": ""
1430
+ }
1431
+ },
1432
+ "type": "scatterpolar"
1433
+ }
1434
+ ],
1435
+ "scatterpolargl": [
1436
+ {
1437
+ "marker": {
1438
+ "colorbar": {
1439
+ "outlinewidth": 0,
1440
+ "ticks": ""
1441
+ }
1442
+ },
1443
+ "type": "scatterpolargl"
1444
+ }
1445
+ ],
1446
+ "scatterternary": [
1447
+ {
1448
+ "marker": {
1449
+ "colorbar": {
1450
+ "outlinewidth": 0,
1451
+ "ticks": ""
1452
+ }
1453
+ },
1454
+ "type": "scatterternary"
1455
+ }
1456
+ ],
1457
+ "surface": [
1458
+ {
1459
+ "colorbar": {
1460
+ "outlinewidth": 0,
1461
+ "ticks": ""
1462
+ },
1463
+ "colorscale": [
1464
+ [
1465
+ 0,
1466
+ "#0d0887"
1467
+ ],
1468
+ [
1469
+ 0.1111111111111111,
1470
+ "#46039f"
1471
+ ],
1472
+ [
1473
+ 0.2222222222222222,
1474
+ "#7201a8"
1475
+ ],
1476
+ [
1477
+ 0.3333333333333333,
1478
+ "#9c179e"
1479
+ ],
1480
+ [
1481
+ 0.4444444444444444,
1482
+ "#bd3786"
1483
+ ],
1484
+ [
1485
+ 0.5555555555555556,
1486
+ "#d8576b"
1487
+ ],
1488
+ [
1489
+ 0.6666666666666666,
1490
+ "#ed7953"
1491
+ ],
1492
+ [
1493
+ 0.7777777777777778,
1494
+ "#fb9f3a"
1495
+ ],
1496
+ [
1497
+ 0.8888888888888888,
1498
+ "#fdca26"
1499
+ ],
1500
+ [
1501
+ 1,
1502
+ "#f0f921"
1503
+ ]
1504
+ ],
1505
+ "type": "surface"
1506
+ }
1507
+ ],
1508
+ "table": [
1509
+ {
1510
+ "cells": {
1511
+ "fill": {
1512
+ "color": "#EBF0F8"
1513
+ },
1514
+ "line": {
1515
+ "color": "white"
1516
+ }
1517
+ },
1518
+ "header": {
1519
+ "fill": {
1520
+ "color": "#C8D4E3"
1521
+ },
1522
+ "line": {
1523
+ "color": "white"
1524
+ }
1525
+ },
1526
+ "type": "table"
1527
+ }
1528
+ ]
1529
+ },
1530
+ "layout": {
1531
+ "annotationdefaults": {
1532
+ "arrowcolor": "#2a3f5f",
1533
+ "arrowhead": 0,
1534
+ "arrowwidth": 1
1535
+ },
1536
+ "autotypenumbers": "strict",
1537
+ "coloraxis": {
1538
+ "colorbar": {
1539
+ "outlinewidth": 0,
1540
+ "ticks": ""
1541
+ }
1542
+ },
1543
+ "colorscale": {
1544
+ "diverging": [
1545
+ [
1546
+ 0,
1547
+ "#8e0152"
1548
+ ],
1549
+ [
1550
+ 0.1,
1551
+ "#c51b7d"
1552
+ ],
1553
+ [
1554
+ 0.2,
1555
+ "#de77ae"
1556
+ ],
1557
+ [
1558
+ 0.3,
1559
+ "#f1b6da"
1560
+ ],
1561
+ [
1562
+ 0.4,
1563
+ "#fde0ef"
1564
+ ],
1565
+ [
1566
+ 0.5,
1567
+ "#f7f7f7"
1568
+ ],
1569
+ [
1570
+ 0.6,
1571
+ "#e6f5d0"
1572
+ ],
1573
+ [
1574
+ 0.7,
1575
+ "#b8e186"
1576
+ ],
1577
+ [
1578
+ 0.8,
1579
+ "#7fbc41"
1580
+ ],
1581
+ [
1582
+ 0.9,
1583
+ "#4d9221"
1584
+ ],
1585
+ [
1586
+ 1,
1587
+ "#276419"
1588
+ ]
1589
+ ],
1590
+ "sequential": [
1591
+ [
1592
+ 0,
1593
+ "#0d0887"
1594
+ ],
1595
+ [
1596
+ 0.1111111111111111,
1597
+ "#46039f"
1598
+ ],
1599
+ [
1600
+ 0.2222222222222222,
1601
+ "#7201a8"
1602
+ ],
1603
+ [
1604
+ 0.3333333333333333,
1605
+ "#9c179e"
1606
+ ],
1607
+ [
1608
+ 0.4444444444444444,
1609
+ "#bd3786"
1610
+ ],
1611
+ [
1612
+ 0.5555555555555556,
1613
+ "#d8576b"
1614
+ ],
1615
+ [
1616
+ 0.6666666666666666,
1617
+ "#ed7953"
1618
+ ],
1619
+ [
1620
+ 0.7777777777777778,
1621
+ "#fb9f3a"
1622
+ ],
1623
+ [
1624
+ 0.8888888888888888,
1625
+ "#fdca26"
1626
+ ],
1627
+ [
1628
+ 1,
1629
+ "#f0f921"
1630
+ ]
1631
+ ],
1632
+ "sequentialminus": [
1633
+ [
1634
+ 0,
1635
+ "#0d0887"
1636
+ ],
1637
+ [
1638
+ 0.1111111111111111,
1639
+ "#46039f"
1640
+ ],
1641
+ [
1642
+ 0.2222222222222222,
1643
+ "#7201a8"
1644
+ ],
1645
+ [
1646
+ 0.3333333333333333,
1647
+ "#9c179e"
1648
+ ],
1649
+ [
1650
+ 0.4444444444444444,
1651
+ "#bd3786"
1652
+ ],
1653
+ [
1654
+ 0.5555555555555556,
1655
+ "#d8576b"
1656
+ ],
1657
+ [
1658
+ 0.6666666666666666,
1659
+ "#ed7953"
1660
+ ],
1661
+ [
1662
+ 0.7777777777777778,
1663
+ "#fb9f3a"
1664
+ ],
1665
+ [
1666
+ 0.8888888888888888,
1667
+ "#fdca26"
1668
+ ],
1669
+ [
1670
+ 1,
1671
+ "#f0f921"
1672
+ ]
1673
+ ]
1674
+ },
1675
+ "colorway": [
1676
+ "#636efa",
1677
+ "#EF553B",
1678
+ "#00cc96",
1679
+ "#ab63fa",
1680
+ "#FFA15A",
1681
+ "#19d3f3",
1682
+ "#FF6692",
1683
+ "#B6E880",
1684
+ "#FF97FF",
1685
+ "#FECB52"
1686
+ ],
1687
+ "font": {
1688
+ "color": "#2a3f5f"
1689
+ },
1690
+ "geo": {
1691
+ "bgcolor": "white",
1692
+ "lakecolor": "white",
1693
+ "landcolor": "#E5ECF6",
1694
+ "showlakes": true,
1695
+ "showland": true,
1696
+ "subunitcolor": "white"
1697
+ },
1698
+ "hoverlabel": {
1699
+ "align": "left"
1700
+ },
1701
+ "hovermode": "closest",
1702
+ "mapbox": {
1703
+ "style": "light"
1704
+ },
1705
+ "paper_bgcolor": "white",
1706
+ "plot_bgcolor": "#E5ECF6",
1707
+ "polar": {
1708
+ "angularaxis": {
1709
+ "gridcolor": "white",
1710
+ "linecolor": "white",
1711
+ "ticks": ""
1712
+ },
1713
+ "bgcolor": "#E5ECF6",
1714
+ "radialaxis": {
1715
+ "gridcolor": "white",
1716
+ "linecolor": "white",
1717
+ "ticks": ""
1718
+ }
1719
+ },
1720
+ "scene": {
1721
+ "xaxis": {
1722
+ "backgroundcolor": "#E5ECF6",
1723
+ "gridcolor": "white",
1724
+ "gridwidth": 2,
1725
+ "linecolor": "white",
1726
+ "showbackground": true,
1727
+ "ticks": "",
1728
+ "zerolinecolor": "white"
1729
+ },
1730
+ "yaxis": {
1731
+ "backgroundcolor": "#E5ECF6",
1732
+ "gridcolor": "white",
1733
+ "gridwidth": 2,
1734
+ "linecolor": "white",
1735
+ "showbackground": true,
1736
+ "ticks": "",
1737
+ "zerolinecolor": "white"
1738
+ },
1739
+ "zaxis": {
1740
+ "backgroundcolor": "#E5ECF6",
1741
+ "gridcolor": "white",
1742
+ "gridwidth": 2,
1743
+ "linecolor": "white",
1744
+ "showbackground": true,
1745
+ "ticks": "",
1746
+ "zerolinecolor": "white"
1747
+ }
1748
+ },
1749
+ "shapedefaults": {
1750
+ "line": {
1751
+ "color": "#2a3f5f"
1752
+ }
1753
+ },
1754
+ "ternary": {
1755
+ "aaxis": {
1756
+ "gridcolor": "white",
1757
+ "linecolor": "white",
1758
+ "ticks": ""
1759
+ },
1760
+ "baxis": {
1761
+ "gridcolor": "white",
1762
+ "linecolor": "white",
1763
+ "ticks": ""
1764
+ },
1765
+ "bgcolor": "#E5ECF6",
1766
+ "caxis": {
1767
+ "gridcolor": "white",
1768
+ "linecolor": "white",
1769
+ "ticks": ""
1770
+ }
1771
+ },
1772
+ "title": {
1773
+ "x": 0.05
1774
+ },
1775
+ "xaxis": {
1776
+ "automargin": true,
1777
+ "gridcolor": "white",
1778
+ "linecolor": "white",
1779
+ "ticks": "",
1780
+ "title": {
1781
+ "standoff": 15
1782
+ },
1783
+ "zerolinecolor": "white",
1784
+ "zerolinewidth": 2
1785
+ },
1786
+ "yaxis": {
1787
+ "automargin": true,
1788
+ "gridcolor": "white",
1789
+ "linecolor": "white",
1790
+ "ticks": "",
1791
+ "title": {
1792
+ "standoff": 15
1793
+ },
1794
+ "zerolinecolor": "white",
1795
+ "zerolinewidth": 2
1796
+ }
1797
+ }
1798
+ },
1799
+ "title": {
1800
+ "font": {
1801
+ "size": 16
1802
+ },
1803
+ "text": "Cyclomatic Complexity Risk Matrix<br><sub>Bubble size represents number of classes | Threshold: 10</sub>"
1804
+ },
1805
+ "xaxis": {
1806
+ "gridcolor": "rgba(128,128,128,0.2)",
1807
+ "showgrid": true,
1808
+ "title": {
1809
+ "text": "Number of High Complexity Methods (≥10)"
1810
+ },
1811
+ "zeroline": true,
1812
+ "zerolinecolor": "rgba(128,128,128,0.2)"
1813
+ },
1814
+ "yaxis": {
1815
+ "gridcolor": "rgba(128,128,128,0.2)",
1816
+ "showgrid": true,
1817
+ "title": {
1818
+ "text": "Average Complexity per Repository"
1819
+ },
1820
+ "zeroline": true,
1821
+ "zerolinecolor": "rgba(128,128,128,0.2)"
1822
+ }
1823
+ }
1824
+ }
1825
+ },
1826
+ "metadata": {},
1827
+ "output_type": "display_data"
1828
+ }
1829
+ ],
1830
+ "source": [
1831
+ "import pandas as pd\n",
1832
+ "import warnings\n",
1833
+ "import plotly.graph_objects as go\n",
1834
+ "import code_data_science.data_table as dt\n",
1835
+ "\n",
1836
+ "warnings.simplefilter(\"ignore\")\n",
1837
+ "\n",
1838
+ "df = dt.read_csv(\"../samples/cyclomatic_complexity.csv\")\n",
1839
+ "\n",
1840
+ "# Filter the data frame to only include rows where repositoryPath contains\n",
1841
+ "# a term in the repository_filter (case insensitive)\n",
1842
+ "if len(repository_filter) > 0:\n",
1843
+ " df = df[\n",
1844
+ " df[\"repositoryPath\"].str.contains(\"|\".join(repository_filter), case=False)\n",
1845
+ " ]\n",
1846
+ "\n",
1847
+ "# Exit early if there are no records and render a plot with a message\n",
1848
+ "if len(df) == 0:\n",
1849
+ " fig = go.Figure()\n",
1850
+ " fig.add_annotation(\n",
1851
+ " text=\"No data available for the selected repositories\",\n",
1852
+ " xref=\"paper\",\n",
1853
+ " yref=\"paper\",\n",
1854
+ " x=0.5,\n",
1855
+ " y=0.5,\n",
1856
+ " showarrow=False,\n",
1857
+ " font=dict(size=14)\n",
1858
+ " )\n",
1859
+ " fig.update_layout(\n",
1860
+ " xaxis=dict(visible=False),\n",
1861
+ " yaxis=dict(visible=False),\n",
1862
+ " margin=dict(l=0, r=0, t=60, b=60),\n",
1863
+ " title=\"Cyclomatic Complexity Risk Matrix\"\n",
1864
+ " )\n",
1865
+ " fig.show(render=\"plotly_mimetype\")\n",
1866
+ "else:\n",
1867
+ " # Calculate metrics for each repository\n",
1868
+ " repo_metrics = df.groupby('repositoryPath').agg({\n",
1869
+ " 'complexity': ['mean', 'count', lambda x: (x >= complexity_threshold).sum()]\n",
1870
+ " }).reset_index()\n",
1871
+ " \n",
1872
+ " # Flatten column names\n",
1873
+ " repo_metrics.columns = ['repository', 'avg_complexity', 'total_methods', 'high_complexity_methods']\n",
1874
+ " \n",
1875
+ " # Count unique classes per repository for bubble size\n",
1876
+ " classes_per_repo = df.groupby('repositoryPath')['className'].nunique().reset_index()\n",
1877
+ " classes_per_repo.columns = ['repository', 'num_classes']\n",
1878
+ " \n",
1879
+ " # Merge the metrics\n",
1880
+ " repo_metrics = repo_metrics.merge(classes_per_repo, on='repository')\n",
1881
+ " \n",
1882
+ " # Create the scatter plot\n",
1883
+ " fig = go.Figure()\n",
1884
+ " \n",
1885
+ " # Add scatter trace\n",
1886
+ " fig.add_trace(go.Scatter(\n",
1887
+ " x=repo_metrics['high_complexity_methods'],\n",
1888
+ " y=repo_metrics['avg_complexity'],\n",
1889
+ " mode='markers',\n",
1890
+ " marker=dict(\n",
1891
+ " size=repo_metrics['num_classes'],\n",
1892
+ " sizemode='area',\n",
1893
+ " sizeref=2.*max(repo_metrics['num_classes'])/(100.**2),\n",
1894
+ " sizemin=4,\n",
1895
+ " color=repo_metrics['high_complexity_methods'],\n",
1896
+ " colorscale='YlOrRd',\n",
1897
+ " showscale=True,\n",
1898
+ " colorbar=dict(\n",
1899
+ " title=\"High Complexity<br>Methods\",\n",
1900
+ " thickness=15,\n",
1901
+ " len=0.7\n",
1902
+ " )\n",
1903
+ " ),\n",
1904
+ " text=repo_metrics['repository'],\n",
1905
+ " customdata=repo_metrics[['total_methods', 'num_classes']],\n",
1906
+ " hovertemplate=(\n",
1907
+ " '<b>%{text}</b><br>' +\n",
1908
+ " 'Average Complexity: %{y:.2f}<br>' +\n",
1909
+ " 'High Complexity Methods: %{x}<br>' +\n",
1910
+ " 'Total Methods: %{customdata[0]}<br>' +\n",
1911
+ " 'Number of Classes: %{customdata[1]}' +\n",
1912
+ " '<extra></extra>'\n",
1913
+ " )\n",
1914
+ " ))\n",
1915
+ " \n",
1916
+ " # Add quadrant lines\n",
1917
+ " # Calculate median values for quadrant boundaries\n",
1918
+ " median_high_complexity = repo_metrics['high_complexity_methods'].median()\n",
1919
+ " median_avg_complexity = repo_metrics['avg_complexity'].median()\n",
1920
+ " \n",
1921
+ " # Add vertical line at median high complexity methods\n",
1922
+ " fig.add_vline(\n",
1923
+ " x=median_high_complexity,\n",
1924
+ " line_dash=\"dash\",\n",
1925
+ " line_color=\"gray\",\n",
1926
+ " opacity=0.5\n",
1927
+ " )\n",
1928
+ " \n",
1929
+ " # Add horizontal line at median average complexity\n",
1930
+ " fig.add_hline(\n",
1931
+ " y=median_avg_complexity,\n",
1932
+ " line_dash=\"dash\",\n",
1933
+ " line_color=\"gray\",\n",
1934
+ " opacity=0.5\n",
1935
+ " )\n",
1936
+ " \n",
1937
+ " # Add quadrant labels\n",
1938
+ " annotations = [\n",
1939
+ " # High Risk (top right)\n",
1940
+ " dict(\n",
1941
+ " x=0.95,\n",
1942
+ " y=0.95,\n",
1943
+ " xref=\"paper\",\n",
1944
+ " yref=\"paper\",\n",
1945
+ " text=\"<b>High Risk</b><br>Many complex methods\",\n",
1946
+ " showarrow=False,\n",
1947
+ " bgcolor=\"rgba(255,0,0,0.1)\",\n",
1948
+ " borderpad=4,\n",
1949
+ " font=dict(size=10)\n",
1950
+ " ),\n",
1951
+ " # Systemic Complexity (top left)\n",
1952
+ " dict(\n",
1953
+ " x=0.05,\n",
1954
+ " y=0.95,\n",
1955
+ " xref=\"paper\",\n",
1956
+ " yref=\"paper\",\n",
1957
+ " text=\"<b>Systemic</b><br>Pervasive complexity\",\n",
1958
+ " showarrow=False,\n",
1959
+ " bgcolor=\"rgba(255,165,0,0.1)\",\n",
1960
+ " borderpad=4,\n",
1961
+ " font=dict(size=10)\n",
1962
+ " ),\n",
1963
+ " # Localized Issues (bottom right)\n",
1964
+ " dict(\n",
1965
+ " x=0.95,\n",
1966
+ " y=0.05,\n",
1967
+ " xref=\"paper\",\n",
1968
+ " yref=\"paper\",\n",
1969
+ " text=\"<b>Localized</b><br>Few problem areas\",\n",
1970
+ " showarrow=False,\n",
1971
+ " bgcolor=\"rgba(255,255,0,0.1)\",\n",
1972
+ " borderpad=4,\n",
1973
+ " font=dict(size=10)\n",
1974
+ " ),\n",
1975
+ " # Low Risk (bottom left)\n",
1976
+ " dict(\n",
1977
+ " x=0.05,\n",
1978
+ " y=0.05,\n",
1979
+ " xref=\"paper\",\n",
1980
+ " yref=\"paper\",\n",
1981
+ " text=\"<b>Low Risk</b><br>Well-maintained\",\n",
1982
+ " showarrow=False,\n",
1983
+ " bgcolor=\"rgba(0,255,0,0.1)\",\n",
1984
+ " borderpad=4,\n",
1985
+ " font=dict(size=10)\n",
1986
+ " )\n",
1987
+ " ]\n",
1988
+ " \n",
1989
+ " # Update layout\n",
1990
+ " fig.update_layout(\n",
1991
+ " title=dict(\n",
1992
+ " text=f\"Cyclomatic Complexity Risk Matrix<br><sub>Bubble size represents number of classes | Threshold: {complexity_threshold}</sub>\",\n",
1993
+ " font=dict(size=16)\n",
1994
+ " ),\n",
1995
+ " xaxis=dict(\n",
1996
+ " title=\"Number of High Complexity Methods (≥\" + str(complexity_threshold) + \")\",\n",
1997
+ " gridcolor='rgba(128,128,128,0.2)',\n",
1998
+ " showgrid=True,\n",
1999
+ " zeroline=True,\n",
2000
+ " zerolinecolor='rgba(128,128,128,0.2)'\n",
2001
+ " ),\n",
2002
+ " yaxis=dict(\n",
2003
+ " title=\"Average Complexity per Repository\",\n",
2004
+ " gridcolor='rgba(128,128,128,0.2)',\n",
2005
+ " showgrid=True,\n",
2006
+ " zeroline=True,\n",
2007
+ " zerolinecolor='rgba(128,128,128,0.2)'\n",
2008
+ " ),\n",
2009
+ " margin=dict(l=60, r=120, t=100, b=60),\n",
2010
+ " plot_bgcolor='white',\n",
2011
+ " annotations=annotations,\n",
2012
+ " hovermode='closest'\n",
2013
+ " )\n",
2014
+ " \n",
2015
+ " # Show the figure\n",
2016
+ " fig.show(render=\"plotly_mimetype\")"
2017
+ ]
2018
+ }
2019
+ ],
2020
+ "metadata": {
2021
+ "kernelspec": {
2022
+ "display_name": ".python",
2023
+ "language": "python",
2024
+ "name": "python3"
2025
+ },
2026
+ "language_info": {
2027
+ "codemirror_mode": {
2028
+ "name": "ipython",
2029
+ "version": 3
2030
+ },
2031
+ "file_extension": ".py",
2032
+ "mimetype": "text/x-python",
2033
+ "name": "python",
2034
+ "nbconvert_exporter": "python",
2035
+ "pygments_lexer": "ipython3",
2036
+ "version": "3.12.8"
2037
+ }
2038
+ },
2039
+ "nbformat": 4,
2040
+ "nbformat_minor": 4
2041
+ }