aws / aws-cdk
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 8,950 units with 87,114 lines of code in units (65.1% of code).
    • 18 very long units (2,860 lines of code)
    • 109 long units (7,203 lines of code)
    • 770 medium size units (22,809 lines of code)
    • 1,562 small units (22,449 lines of code)
    • 6,491 very small units (31,793 lines of code)
3% | 8% | 26% | 25% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts3% | 8% | 26% | 25% | 36%
py0% | 11% | 37% | 26% | 24%
js0% | 27% | 32% | 13% | 26%
go0% | 0% | 0% | 28% | 71%
cs0% | 0% | 0% | 0% | 100%
java0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/@aws-cdk3% | 8% | 25% | 25% | 37%
packages/@aws-cdk-containers16% | 4% | 16% | 28% | 33%
tools/@aws-cdk2% | 11% | 27% | 25% | 32%
packages/aws-cdk1% | 10% | 30% | 28% | 28%
packages/cdk-assets0% | 9% | 24% | 23% | 41%
scripts0% | 18% | 19% | 24% | 37%
packages/awslint0% | 0% | 30% | 31% | 38%
packages/aws-cdk-migration0% | 0% | 69% | 20% | 9%
packages/aws-cdk-lib0% | 0% | 44% | 26% | 29%
packages/cdk-dasm0% | 0% | 84% | 0% | 15%
packages/@monocdk-experiment0% | 0% | 45% | 54% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in packages/@aws-cdk/aws-opensearchservice/lib/domain.ts
381 97 3
constructor()
in packages/@aws-cdk/aws-elasticsearch/lib/domain.ts
379 95 3
constructor()
in packages/@aws-cdk/aws-msk/lib/cluster.ts
167 17 3
export function spotInterruptHandler()
in packages/@aws-cdk/aws-eks-legacy/lib/spot-interrupt-handler.ts
167 1 1
constructor()
in packages/@aws-cdk/aws-lambda/lib/function.ts
160 41 3
constructor()
in packages/@aws-cdk/aws-eks/lib/cluster.ts
152 34 3
constructor()
in packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts
150 27 3
constructor()
in packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/task-record-manager.ts
140 1 3
private parseIfCfnIntrinsic()
in packages/@aws-cdk/core/lib/cfn-parse.ts
138 32 1
constructor()
in packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
126 29 3
private emitResourceType()
in tools/@aws-cdk/cfn2ts/lib/codegen.ts
125 28 2
public async deploy()
in packages/aws-cdk/lib/cdk-toolkit.ts
123 25 1
constructor()
in packages/@aws-cdk/aws-ec2/lib/launch-template.ts
118 21 3
constructor()
in packages/@aws-cdk-containers/ecs-service-extensions/lib/service.ts
117 33 3
await write()
in packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts
110 1 88
private toOriginProperty()
in packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts
103 29 2
constructor()
in packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts
102 18 3
constructor()
in packages/@aws-cdk/aws-codebuild/lib/project.ts
102 29 3
def handler()
in packages/@aws-cdk/aws-eks-legacy/lib/cluster-resource/index.py
99 24 2
constructor()
in packages/@aws-cdk/aws-docdb/lib/cluster.ts
98 17 3