aws-samples / aws-ecs-devops-using-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 85 units with 1,103 lines of code in units (71.5% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (191 lines of code)
    • 6 medium size units (210 lines of code)
    • 30 small units (449 lines of code)
    • 46 very small units (253 lines of code)
0% | 17% | 19% | 40% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 18% | 20% | 41% | 19%
py0% | 0% | 0% | 24% | 75%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
infra/ecs-service/construct0% | 41% | 36% | 14% | 6%
infra/ecs-service0% | 42% | 25% | 8% | 24%
lib/template/pattern0% | 0% | 11% | 77% | 11%
lib/template0% | 0% | 26% | 45% | 27%
lib/template/stack0% | 0% | 0% | 69% | 30%
infra/common-infra0% | 0% | 0% | 67% | 32%
lib/template/construct0% | 0% | 0% | 76% | 23%
codes/sample-frontend-flask/app0% | 0% | 0% | 78% | 21%
lib/template/common0% | 0% | 0% | 0% | 100%
codes/sample-backend-fastapi/app0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private createBuildProject()
in infra/ecs-service/construct/ecs-cicd-const.ts
71 1 2
constructor()
in infra/ecs-service/construct/ecs-infra-const.ts
62 5 3
onEcsPostConstructor()
in infra/ecs-service/ecs-alb-service-stack.ts
58 1 3
constructor()
in infra/ecs-service/construct/ecs-cicd-const.ts
47 1 3
constructor()
in infra/ecs-service/construct/ecs-monitor-const.ts
45 2 3
private createEcsServiceTask()
in infra/ecs-service/ecs-common-service-stack.ts
34 1 3
private createLambda()
in lib/template/pattern/lambda-pattern.ts
33 11 4
private updateContextArgs()
in lib/template/app-context.ts
26 8 2
private createExecutionRole()
in infra/ecs-service/construct/ecs-infra-const.ts
25 1 1
constructor()
in lib/template/construct/base/base-construct.ts
20 1 3
constructor()
in lib/template/stack/base/base-stack.ts
20 1 2
public createEndpointInstanceMetrics()
in lib/template/pattern/cloudwatch-pattern.ts
18 2 4
public createEndpointInvocationMetrics()
in lib/template/pattern/cloudwatch-pattern.ts
18 2 4
private findAppConfigFile()
in lib/template/app-context.ts
18 5 1
private createMetricAlarm()
in infra/ecs-service/construct/ecs-monitor-const.ts
18 2 2
constructor()
in infra/common-infra/vpc-infra-stack.ts
17 1 2
public createDynamoDBMetric()
in lib/template/pattern/cloudwatch-pattern.ts
16 3 4
public createEsDomainMetric()
in lib/template/pattern/cloudwatch-pattern.ts
16 2 4
public createEsDomainMetric2()
in lib/template/pattern/cloudwatch-pattern.ts
16 2 4
protected importVpc()
in lib/template/stack/vpc/vpc-base-stack.ts
16 5 1