facebook / chef-cookbooks
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 484 units with 5,890 lines of code in units (21.1% of code).
    • 2 very long units (367 lines of code)
    • 17 long units (1,247 lines of code)
    • 44 medium size units (1,298 lines of code)
    • 92 small units (1,319 lines of code)
    • 329 very small units (1,659 lines of code)
6% | 21% | 22% | 22% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rb6% | 21% | 22% | 22% | 28%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cookbooks/fb_storage19% | 23% | 24% | 14% | 17%
cookbooks/fb_fstab0% | 55% | 15% | 13% | 14%
cookbooks/fb_users0% | 61% | 25% | 8% | 3%
cookbooks/fb_swap0% | 40% | 11% | 35% | 12%
cookbooks/fb_network_scripts0% | 24% | 17% | 28% | 29%
cookbooks/fb_systemd0% | 36% | 38% | 0% | 25%
cookbooks/fb_helpers0% | 4% | 21% | 19% | 54%
cookbooks/fb_apt0% | 0% | 58% | 27% | 13%
cookbooks/fb_modprobe0% | 0% | 46% | 13% | 40%
cookbooks/fb_system_upgrade0% | 0% | 100% | 0% | 0%
cookbooks/fb_chef_hints0% | 0% | 51% | 48% | 0%
cookbooks/fb_yum_repos0% | 0% | 30% | 37% | 32%
cookbooks/fb_collectd0% | 0% | 100% | 0% | 0%
cookbooks/fb_choco0% | 0% | 33% | 19% | 46%
cookbooks/fb_ipset0% | 0% | 52% | 26% | 21%
cookbooks/fb_fluentbit0% | 0% | 20% | 32% | 46%
cookbooks/fb_launchd0% | 0% | 77% | 0% | 22%
spec0% | 0% | 0% | 78% | 21%
cookbooks/fb_powershell0% | 0% | 0% | 81% | 18%
cookbooks/fb_sdparm0% | 0% | 0% | 89% | 10%
cookbooks/fb_apache0% | 0% | 0% | 83% | 16%
cookbooks/fb_sysctl0% | 0% | 0% | 79% | 20%
cookbooks/fb_e2fsprogs0% | 0% | 0% | 100% | 0%
cookbooks/fb_iptables0% | 0% | 0% | 36% | 63%
cookbooks/fb_hdparm0% | 0% | 0% | 66% | 33%
cookbooks/fb_dnf0% | 0% | 0% | 100% | 0%
cookbooks/fb_grubby0% | 0% | 0% | 31% | 68%
cookbooks/fb_ntp0% | 0% | 0% | 71% | 28%
cookbooks/fb_rsync0% | 0% | 0% | 35% | 64%
spec/chefspec0% | 0% | 0% | 100% | 0%
cookbooks/fb_readline0% | 0% | 0% | 33% | 66%
cookbooks/fb_timers0% | 0% | 0% | 0% | 100%
cookbooks/fb_nscd0% | 0% | 0% | 0% | 100%
cookbooks/fb_grub0% | 0% | 0% | 0% | 100%
cookbooks/fb_screen0% | 0% | 0% | 0% | 100%
cookbooks/fb_sysfs0% | 0% | 0% | 0% | 100%
cookbooks/fb_syslog0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
255 52 0
112 16 1
94 27 1
87 18 1
87 18 2
85 22 1
84 15 3
81 25 0
77 17 0
76 18 2
75 16 2
72 19 1
68 20 3
68 14 0
65 7 1
61 9 1
59 13 1
54 9 2
54 11 1
49 14 3
46 14 2
43 9 2
39 9 0
39 8 1
37 12 2
36 5 1
36 4 1
36 4 2
35 7 0
35 7 1
34 7 2
34 4 1
32 8 3
32 6 3
31 5 3
29 8 3
29 6 3
29 8 2
28 4 1
28 4 3
28 8 1
28 5 2
27 2 1
27 7 2
26 7 1
26 7 3
25 12 3
25 6 3
25 6 2
25 3 0