facebook / pyre-check
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 1,966 units with 12,319 lines of code in units (10.0% of code).
    • 3 very long units (472 lines of code)
    • 8 long units (521 lines of code)
    • 105 medium size units (3,220 lines of code)
    • 187 small units (2,693 lines of code)
    • 1,663 very small units (5,413 lines of code)
3% | 4% | 26% | 21% | 43%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 4% | 24% | 23% | 44%
c5% | 3% | 38% | 25% | 27%
pyi0% | 0% | 21% | 6% | 72%
ts0% | 0% | 63% | 0% | 36%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
client10% | 6% | 16% | 24% | 42%
tools/generate_taint_models16% | 0% | 17% | 9% | 55%
source/hack_parallel5% | 3% | 38% | 25% | 27%
tools/upgrade0% | 9% | 31% | 26% | 32%
client/commands0% | 5% | 23% | 24% | 47%
scripts0% | 7% | 36% | 27% | 28%
tools/incremental_test0% | 0% | 34% | 27% | 37%
stubs/django0% | 0% | 29% | 7% | 63%
tools/playground0% | 0% | 86% | 10% | 3%
client/log0% | 0% | 32% | 33% | 34%
scripts/pypi0% | 0% | 22% | 18% | 58%
tools/ide_plugins0% | 0% | 63% | 0% | 36%
api0% | 0% | 0% | 35% | 64%
pyre_extensions0% | 0% | 0% | 21% | 78%
stubs/lxml0% | 0% | 0% | 76% | 23%
client/libcst_vendored_visitors0% | 0% | 0% | 4% | 95%
stubs/mysql0% | 0% | 0% | 0% | 100%
stubs/integration_test0% | 0% | 0% | 0% | 100%
tools/pysa_integration_tests0% | 0% | 0% | 0% | 100%
stubs/rest_framework0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
223 38 1
148 32 3
101 9 2
82 21 2
73 18 1
69 18 0
66 10 1
65 13 2
58 12 0
56 3 1
52 4 2
49 5 1
49 4 1
49 15 1
47 1 1
47 5 1
46 10 3
46 2 2
46 11 3
45 12 1
45 6 0
44 9 1
44 9 0
43 6 1
43 12 2
43 11 2
41 9 1
40 5 0
40 1 0
39 6 1
38 7 1
38 9 1
38 9 2
38 6 1
37 1 1
37 9 1
37 5 1
37 1 1
36 14 1
36 9 1
35 2 1
35 6 2
35 5 1
34 5 1
34 6 1
33 1 2
33 4 2
33 6 1
33 4 3
32 13 2