cdklabs / cdk-watchful
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 115 units with 1,136 lines of code in units (70.2% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (84 lines of code)
    • 8 medium size units (269 lines of code)
    • 25 small units (322 lines of code)
    • 81 very small units (461 lines of code)
0% | 7% | 23% | 28% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 7% | 23% | 28% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 12% | 31% | 29% | 26%
example0% | 0% | 93% | 0% | 6%
src/monitoring/aws/api-gateway0% | 0% | 0% | 71% | 28%
src/monitoring/aws/ecs0% | 0% | 0% | 16% | 83%
src/widget0% | 0% | 0% | 80% | 20%
src/monitoring/aws/sqs0% | 0% | 0% | 13% | 86%
src/monitoring/aws/redshift0% | 0% | 0% | 23% | 76%
src/monitoring/aws/rds0% | 0% | 0% | 35% | 64%
src/monitoring/aws/lambda0% | 0% | 0% | 36% | 63%
src/monitoring/aws/dynamodb0% | 0% | 0% | 64% | 35%
src/monitoring/aws/sns0% | 0% | 0% | 0% | 100%
src/monitoring/aws/state-machine0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in src/ecs.ts
84 3 3
constructor()
in src/rds-aurora.ts
50 1 3
constructor()
in src/lambda.ts
43 2 3
constructor()
in src/api-gateway.ts
35 5 3
constructor()
in src/watchful.ts
34 12 3
public visit()
in src/aspect.ts
30 22 1
constructor()
in example/index.ts
29 1 3
constructor()
in example/index.ts
26 7 3
private createExecutionMetrics()
in src/state-machine.ts
22 1 0
constructor()
in src/dynamodb.ts
20 3 3
20 1 4
19 1 4
private createCallGraphWidget()
in src/api-gateway.ts
16 3 2
15 1 4
protected metric()
in src/monitoring/aws/api-gateway/metrics.ts
15 2 4
13 1 2
12 1 2
metricHttpErrorStatusCodeRate()
in src/monitoring/aws/ecs/metrics.ts
12 1 2
12 1 1
12 1 1