microsoft / git
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 10,336 units with 228,267 lines of code in units (31.7% of code).
    • 220 very long units (37,037 lines of code)
    • 657 long units (44,470 lines of code)
    • 2,484 medium size units (77,804 lines of code)
    • 2,865 small units (42,093 lines of code)
    • 4,110 very small units (26,863 lines of code)
16% | 19% | 34% | 18% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c15% | 19% | 34% | 18% | 11%
perl20% | 21% | 32% | 15% | 9%
pm21% | 14% | 31% | 18% | 13%
py19% | 12% | 32% | 15% | 19%
h3% | 7% | 21% | 19% | 47%
pl0% | 9% | 50% | 18% | 21%
go0% | 14% | 39% | 34% | 10%
t0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT13% | 19% | 34% | 19% | 12%
builtin25% | 20% | 31% | 14% | 7%
perl17% | 14% | 33% | 20% | 14%
sha1dc74% | 13% | 8% | 1% | 2%
compat11% | 16% | 39% | 20% | 12%
gitweb15% | 25% | 36% | 14% | 8%
contrib11% | 18% | 39% | 19% | 10%
t7% | 22% | 37% | 17% | 14%
refs13% | 20% | 30% | 20% | 14%
xdiff17% | 17% | 39% | 14% | 11%
reftable3% | 15% | 44% | 16% | 20%
trace20% | 6% | 22% | 48% | 23%
block-sha10% | 67% | 17% | 9% | 6%
sha2560% | 46% | 13% | 14% | 25%
ewah0% | 7% | 38% | 23% | 30%
negotiator0% | 0% | 27% | 26% | 46%
ppc0% | 0% | 45% | 54% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
sub read_all_remotes()
in perl/Git/SVN.pm
778 151 0
int cmd_rebase()
in builtin/rebase.c
690 166 3
int cmd_format_patch()
in builtin/log.c
423 104 3
408 81 5
int cmd_rev_parse()
in builtin/rev-parse.c
407 127 3
360 155 6
int cmd_merge()
in builtin/merge.c
352 114 3
int cmd_clone()
in builtin/clone.c
345 101 3
326 1 4
300 94 3
int cmd_update_index()
in builtin/update-index.c
297 57 3
int cmd_grep()
in builtin/grep.c
295 79 3
290 90 2
int cmd_config()
in builtin/config.c
290 85 3
sub patch_update_file()
in git-add--interactive.perl
290 69 0
int cmd_repack()
in builtin/repack.c
285 74 3
int cmd_blame()
in builtin/blame.c
283 69 3
int cmd_pack_objects()
in builtin/pack-objects.c
280 75 3
279 88 5
int cmd_show_branch()
in builtin/show-branch.c
275 75 3