instagram / LibCST
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 3,624 units with 21,101 lines of code in units (51.7% of code).
    • 6 very long units (1,054 lines of code)
    • 24 long units (1,516 lines of code)
    • 136 medium size units (3,950 lines of code)
    • 332 small units (4,896 lines of code)
    • 3,126 very small units (9,685 lines of code)
4% | 7% | 18% | 23% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs10% | 14% | 24% | 30% | 19%
py1% | 2% | 15% | 18% | 61%
pyi0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
native/libcst10% | 12% | 24% | 31% | 20%
libcst4% | 2% | 4% | 2% | 86%
libcst/_parser0% | 10% | 33% | 23% | 32%
native/libcst_derive0% | 80% | 19% | 0% | 0%
libcst/_nodes0% | 0% | 16% | 34% | 49%
libcst/codemod0% | 0% | 19% | 14% | 65%
libcst/matchers0% | 0% | 15% | 22% | 61%
libcst/testing0% | 0% | 75% | 0% | 24%
libcst/metadata0% | 0% | 6% | 24% | 69%
libcst/codegen0% | 0% | 21% | 41% | 37%
libcst/helpers0% | 0% | 0% | 18% | 81%
stubs/libcst_native0% | 0% | 0% | 0% | 100%
stubs0% | 0% | 0% | 0% | 100%
stubs/libcst0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
199 1 2
199 1 2
196 6 2
170 1 2
156 30 1
134 31 2
87 1 0
84 15 1
77 16 3
75 2 2
74 14 2
72 1 2
72 1 2
72 1 1
72 1 1
68 3 2
61 6 1
58 1 0
57 1 0
56 11 2
55 10 1
55 5 2
54 8 2
54 12 2
53 1 0
53 4 2
53 5 2
52 4 2
51 10 4
51 7 1
49 1 0
49 27 2
49 8 2
48 5 2
47 1 0
47 1 1
46 5 2
45 14 2
45 1 0
44 1 2
44 14 1
44 10 2
42 1 0
42 2 2
41 3 2
41 1 0
39 6 5
39 9 2
38 9 2
36 10 2