microsoft / etcd3
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 282 units with 2,039 lines of code in units (44.8% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (57 lines of code)
    • 10 medium size units (305 lines of code)
    • 40 small units (578 lines of code)
    • 231 very small units (1,099 lines of code)
0% | 2% | 14% | 28% | 53%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 2% | 14% | 28% | 53%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 2% | 14% | 28% | 53%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private async loop()
in src/election.ts
57 9 0
public async exec()
in src/connection-pool.ts
44 8 4
public getMetadata()
in src/connection-pool.ts
42 5 0
private keepalive()
in src/lease.ts
42 4 0
31 5 0
private commit()
in src/stm.ts
29 6 0
private async start()
in src/election.ts
28 5 0
25 8 1
public grant()
in src/auth.ts
22 2 2
public and()
in src/builder.ts
21 2 4
public acquire()
in src/lock.ts
21 2 0
public keepaliveOnce()
in src/lease.ts
20 2 1
19 5 2
public addChanges()
in src/stm.ts
19 4 1
18 2 2
function runServiceCall()
in src/connection-pool.ts
17 3 5
17 3 2
17 5 2
private handleError()
in src/watch.ts
17 3 1
public revoke()
in src/auth.ts
16 2 2