microsoft / lain
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 201 units with 3,093 lines of code in units (52.9% of code).
    • 1 very long units (111 lines of code)
    • 11 long units (753 lines of code)
    • 33 medium size units (1,062 lines of code)
    • 40 small units (607 lines of code)
    • 116 very small units (560 lines of code)
3% | 24% | 34% | 19% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs3% | 24% | 34% | 19% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lain/src10% | 14% | 33% | 9% | 31%
lain_derive/src0% | 42% | 34% | 15% | 7%
testsuite/src0% | 16% | 40% | 36% | 7%
testsuite/benches0% | 0% | 42% | 57% | 0%
lain_derive/src/internals0% | 0% | 0% | 29% | 70%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
fn new_fuzzed()
in lain/src/new_fuzzed.rs
111 20 2
fn field_serialized_size()
in lain_derive/src/serialize.rs
96 15 4
fn new_fuzzed()
in lain/src/new_fuzzed.rs
88 3 2
fn gen_struct_new_fuzzed_impl()
in lain_derive/src/new_fuzzed_old.rs
86 11 2
fn gen_struct_mutate_impl()
in lain_derive/src/fuzzerobject.rs
76 10 1
fn grow_vec()
in lain/src/mutatable.rs
69 10 3
fn field_serializer()
in lain_derive/src/serialize.rs
67 13 3
59 4 0
fn variable_size_object_helper()
in lain_derive/src/lib.rs
53 8 1
fn serialized_size_enum()
in lain_derive/src/serialize.rs
53 3 4
fn serialized_size_enum_visitor()
in lain_derive/src/serialize.rs
53 2 3
53 3 0
fn new_fuzzed()
in lain/src/new_fuzzed.rs
50 6 2
fn new_fuzzed()
in lain/src/new_fuzzed.rs
50 6 2
fn mutate()
in lain/src/mutatable.rs
48 10 3
fn field_initializer()
in lain_derive/src/mutations.rs
45 5 2
fn new_fuzzed_enum()
in lain_derive/src/mutations.rs
43 6 2
fn struct_field_constraints()
in lain_derive/src/mutations.rs
43 9 2
fn new_fuzzed()
in lain/src/new_fuzzed.rs
42 9 2
fn new_fuzzed()
in lain/src/new_fuzzed.rs
41 1 2