pytorch / captum
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 775 units with 5,889 lines of code in units (33.4% of code).
    • 3 very long units (375 lines of code)
    • 5 long units (321 lines of code)
    • 28 medium size units (850 lines of code)
    • 87 small units (1,173 lines of code)
    • 652 very small units (3,170 lines of code)
6% | 5% | 14% | 19% | 53%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js32% | 33% | 5% | 16% | 11%
tsx28% | 0% | 46% | 18% | 5%
py0% | 1% | 12% | 20% | 65%
ts0% | 0% | 72% | 0% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
website/pages66% | 13% | 0% | 12% | 7%
captum/insights13% | 0% | 32% | 22% | 31%
website/core0% | 58% | 16% | 16% | 8%
scripts0% | 39% | 60% | 0% | 0%
captum/metrics0% | 39% | 25% | 16% | 18%
captum/attr0% | 0% | 9% | 21% | 69%
captum/_utils0% | 0% | 10% | 9% | 79%
captum/concept0% | 0% | 11% | 22% | 65%
captum/influence0% | 0% | 6% | 35% | 57%
captum/robust0% | 0% | 0% | 31% | 68%
website/static0% | 0% | 0% | 56% | 44%
ROOT0% | 0% | 0% | 0% | 100%
captum/log0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
133 17 0
126 5 1
116 6 0
70 3 0
68 4 0
66 2 1
66 11 1
51 3 0
48 7 1
46 6 1
43 7 1
42 9 1
38 1 0
37 12 2
37 2 2
36 4 1
36 2 1
34 5 1
32 5 2
31 8 2
30 2 1
29 1 0
27 15 1
26 3 4
25 7 1
25 5 4
24 8 3
24 3 2
23 5 2
23 8 1
23 4 3
23 5 1
23 1 2
22 4 3
22 2 1
21 4 2
20 1 1
19 1 1
19 5 4
19 9 6
19 4 1
19 5 3
18 1 0
18 2 1
18 1 1
18 1 1
18 4 0
18 1 1
18 2 3
17 2 1