aws-samples / aws-serverless-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 26 units with 198 lines of code in units (83.5% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 0 medium size units (0 lines of code)
    • 6 small units (91 lines of code)
    • 20 very small units (107 lines of code)
0% | 0% | 0% | 45% | 54%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 0% | 0% | 60% | 39%
py0% | 0% | 0% | 27% | 72%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
infra/stack0% | 0% | 0% | 69% | 30%
codes/lambda/bucket-function/src0% | 0% | 0% | 38% | 61%
codes/lambda/rest-function/src0% | 0% | 0% | 28% | 71%
codes/lambda/topic-function/src0% | 0% | 0% | 0% | 100%
lib/utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private createLambdaFunctionBucket()
in infra/stack/serverless-stack.ts
20 1 2
private createApiRest()
in infra/stack/serverless-stack.ts
18 1 1
private createLambdaFunctionTopic()
in infra/stack/serverless-stack.ts
16 1 2
private createLambdaFunctionRest()
in infra/stack/serverless-stack.ts
14 1 1
def handle()
in codes/lambda/bucket-function/src/handler.py
12 4 2
def create_response_body()
in codes/lambda/rest-function/src/handler.py
11 2 1
def get_list()
in codes/lambda/bucket-function/src/handler.py
10 2 3
def handle()
in codes/lambda/rest-function/src/handler.py
10 2 2
constructor()
in infra/stack/serverless-stack.ts
10 1 3
private createDdbTable()
in infra/stack/serverless-stack.ts
9 1 0
def handle()
in codes/lambda/topic-function/src/handler.py
7 2 2
def get_list()
in codes/lambda/rest-function/src/handler.py
7 2 1
function addProjectPrefix()
in lib/utils/config-loaders.ts
7 2 1
def get_table()
in codes/lambda/rest-function/src/handler.py
6 2 1
private createSnsTopic()
in infra/stack/serverless-stack.ts
6 1 0
def put_ddb()
in codes/lambda/topic-function/src/handler.py
5 2 2
def put_ddb()
in codes/lambda/bucket-function/src/handler.py
5 2 2
function loadConfigFromFile()
in lib/utils/config-loaders.ts
5 1 1
private createS3Bucket()
in infra/stack/serverless-stack.ts
5 1 0
export function loadConfig()
in lib/utils/config-loaders.ts
3 1 1