facebookincubator / nvdtools
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 849 units with 10,458 lines of code in units (71.7% of code).
    • 2 very long units (220 lines of code)
    • 15 long units (944 lines of code)
    • 132 medium size units (4,017 lines of code)
    • 171 small units (2,533 lines of code)
    • 529 very small units (2,744 lines of code)
2% | 9% | 38% | 24% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go2% | 9% | 38% | 24% | 26%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
wfn13% | 13% | 41% | 23% | 8%
cmd/cpe2cve23% | 15% | 42% | 14% | 3%
vulndb0% | 19% | 46% | 24% | 9%
providers/idefense0% | 41% | 44% | 5% | 7%
providers/nvd0% | 14% | 43% | 22% | 19%
providers/rustsec0% | 45% | 54% | 0% | 0%
cmd/wfnconvert0% | 15% | 41% | 33% | 9%
vulndb/sqlutil0% | 12% | 9% | 17% | 60%
providers/flexera0% | 19% | 32% | 36% | 11%
rpm0% | 25% | 28% | 33% | 12%
cvefeed0% | 0% | 37% | 30% | 32%
providers/redhat0% | 0% | 41% | 45% | 12%
providers/snyk0% | 0% | 73% | 17% | 8%
providers/vfeed0% | 0% | 47% | 18% | 33%
cvefeed/nvd0% | 0% | 62% | 15% | 22%
cvss30% | 0% | 20% | 9% | 70%
cmd/csv2cpe0% | 0% | 75% | 11% | 12%
providers/fireeye0% | 0% | 48% | 32% | 18%
providers/rbs0% | 0% | 61% | 24% | 13%
providers/lib0% | 0% | 27% | 34% | 38%
cmd/redhat_filter0% | 0% | 69% | 15% | 15%
cmd/rpm2cpe0% | 0% | 39% | 41% | 18%
cmd/redhat_query0% | 0% | 75% | 0% | 25%
cvss20% | 0% | 8% | 19% | 71%
cmd/nvdsync0% | 0% | 91% | 0% | 8%
cpedict0% | 0% | 29% | 51% | 18%
cmd/vulndb0% | 0% | 14% | 17% | 68%
cmd/vfeed2nvd0% | 0% | 82% | 0% | 17%
stats0% | 0% | 18% | 14% | 67%
cmd/snyk2nvd0% | 0% | 0% | 87% | 12%
vulndb/mysql0% | 0% | 0% | 78% | 21%
cmd/rbs2nvd0% | 0% | 0% | 73% | 26%
cmd/fireeye2nvd0% | 0% | 0% | 72% | 27%
cmd/flexera2nvd0% | 0% | 0% | 72% | 27%
cmd/rustsec2nvd0% | 0% | 0% | 85% | 15%
cmd/idefense2nvd0% | 0% | 0% | 45% | 54%
cmd/redhat2nvd0% | 0% | 0% | 51% | 48%
vulndb/debug0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
113 52 3
107 24 0
96 11 1
72 18 5
72 6 1
70 15 1
68 32 1
65 13 1
64 6 1
59 4 1
58 23 1
56 10 0
54 10 1
54 18 2
53 11 1
52 12 1
51 18 1
50 14 1
50 6 1
48 7 1
47 8 1
47 8 1
47 7 1
46 8 4
46 8 1
46 8 1
45 8 0
43 8 1
43 9 1
43 7 1
42 7 1
41 4 0
41 11 1
41 5 1
41 8 1
41 20 1
40 7 1
40 17 2
40 21 2
39 7 1
39 4 1
39 4 1
39 4 1
38 12 2
37 2 1
37 12 2
37 8 1
37 15 1
36 9 1
36 7 1