aws-samples / aws-serverless-workshop-greater-china-region
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 884 units with 10,393 lines of code in units (81.6% of code).
    • 3 very long units (366 lines of code)
    • 17 long units (1,141 lines of code)
    • 114 medium size units (3,428 lines of code)
    • 186 small units (2,711 lines of code)
    • 564 very small units (2,747 lines of code)
3% | 10% | 32% | 26% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 9% | 34% | 26% | 27%
ts48% | 51% | 0% | 0% | 0%
js0% | 0% | 31% | 63% | 4%
java0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Others_Labs2% | 9% | 32% | 25% | 29%
Lab6-StepFunction49% | 0% | 30% | 15% | 4%
Unclassified0% | 21% | 41% | 33% | 3%
Lab12-Lambda_EFS_Inference0% | 69% | 0% | 30% | 0%
Lab4-WildRyde-WebApplication0% | 100% | 0% | 0% | 0%
Lab13-Dump-DynamoDB-into-CSV-Stored-in-S30% | 0% | 29% | 66% | 4%
Lab10-DynamoDB-Stream-EventBridge0% | 0% | 58% | 21% | 20%
Others_Tools0% | 0% | 100% | 0% | 0%
Lab8A-CICD-CodePipeline0% | 0% | 85% | 0% | 15%
Lab11-Provision-Concurrency0% | 0% | 0% | 100% | 0%
Lab8B-CICD-Jenkins0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in Lab6-StepFunction/cdk-deployment/lib/lab6-stack.ts
144 2 3
def analyze_scalar()
in Others_Labs/code/Survey-Survey/yaml/emitter.py
111 30 2
def analyze_scalar()
in Others_Labs/code/SurveySubmit/yaml/emitter.py
111 30 2
def lambda_handler()
in Lab2-EC2AutoSnapshot_CloudWatchEvent+Lambda/auto_snapshot_lambda.py
95 28 2
constructor()
in Lab12-Lambda_EFS_Inference/lib/lambda_efsml-stack.ts
94 1 3
def parse_node()
in Others_Labs/code/Survey-Survey/yaml/parser.py
94 29 3
def parse_node()
in Others_Labs/code/SurveySubmit/yaml/parser.py
94 29 3
def indent()
in Others_Labs/code/Survey-Survey/yattag/indentation.py
75 19 5
def indent()
in Others_Labs/code/SurveySubmit/yattag/indentation.py
75 19 5
def lambda_handler()
in Others_Labs/code/Survey-Survey/survey.py
63 7 2
def lambda_handler()
in Others_Labs/code/SurveySubmit/survey.py
60 7 2
def write_plain()
in Others_Labs/code/Survey-Survey/yaml/emitter.py
58 22 3
def write_plain()
in Others_Labs/code/SurveySubmit/yaml/emitter.py
58 22 3
constructor()
in Lab4-WildRyde-WebApplication/deploy/lib/lab4-stack.ts
57 1 3
def write_single_quoted()
in Others_Labs/code/Survey-Survey/yaml/emitter.py
53 4 3
def write_double_quoted()
in Others_Labs/code/Survey-Survey/yaml/emitter.py
53 21 3
def write_folded()
in Others_Labs/code/Survey-Survey/yaml/emitter.py
53 24 2
def write_single_quoted()
in Others_Labs/code/SurveySubmit/yaml/emitter.py
53 4 3
def write_double_quoted()
in Others_Labs/code/SurveySubmit/yaml/emitter.py
53 21 3
def write_folded()
in Others_Labs/code/SurveySubmit/yaml/emitter.py
53 24 2