aws-samples / aws-reinvent-trivia-game
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 44 units with 1,397 lines of code in units (38.9% of code).
    • 5 very long units (728 lines of code)
    • 3 long units (233 lines of code)
    • 7 medium size units (218 lines of code)
    • 6 small units (83 lines of code)
    • 23 very small units (135 lines of code)
52% | 16% | 15% | 5% | 9%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts66% | 21% | 9% | 0% | 3%
js0% | 0% | 38% | 27% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
trivia-backend/infra83% | 16% | 0% | 0% | <1%
pipelines/src0% | 41% | 49% | 0% | 8%
chat-bot/bot0% | 0% | 51% | 32% | 16%
static-site/app0% | 0% | 31% | 26% | 42%
static-site/cdk0% | 0% | 0% | 0% | 100%
trivia-backend/app0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in trivia-backend/infra/cdk/ecs-service-blue-green.ts
252 3 3
constructor()
in trivia-backend/infra/codedeploy-blue-green/infra-setup.ts
124 5 3
constructor()
in trivia-backend/infra/cdk/eks/kubernetes-resources/reinvent-trivia.ts
124 1 3
constructor()
in trivia-backend/infra/cdk/eks-service.ts
123 3 2
constructor()
in trivia-backend/infra/cdk/eks/alb-ingress-controller-policy.ts
105 1 2
constructor()
in pipelines/src/api-service-codedeploy-pipeline.ts
89 1 3
constructor()
in trivia-backend/infra/cdk/ecs-task-sets.ts
89 2 3
constructor()
in trivia-backend/infra/cdk/eks-service.ts
55 4 3
constructor()
in pipelines/src/static-site-pipeline.ts
45 1 3
async function nextQuestion()
in chat-bot/bot/bot.js
37 4 1
private addDeployStage()
in pipelines/src/api-service-codedeploy-pipeline.ts
36 1 4
render()
in static-site/app/js/Card.js
29 4 0
async function finishGame()
in chat-bot/bot/bot.js
27 4 1
private createDeployAction()
in pipelines/src/static-site-pipeline.ts
23 2 2
render()
in static-site/app/js/app.js
21 3 0
async function startGame()
in chat-bot/bot/bot.js
18 1 1
render()
in static-site/app/js/pageNotFound.js
17 2 0
componentDidMount()
in static-site/app/js/app.js
13 2 0
render()
in static-site/app/js/Headers.js
12 1 0
function elicitSlot()
in chat-bot/bot/bot.js
12 1 5