aws-samples / amazon-sagemaker-model-serving-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 30 units with 292 lines of code in units (72.3% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 4 medium size units (125 lines of code)
    • 3 small units (35 lines of code)
    • 23 very small units (132 lines of code)
0% | 0% | 42% | 11% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 50% | 14% | 35%
ts0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
codes/lambda/api-testing-tester/src0% | 0% | 78% | 0% | 21%
codes/lambda/api-hosting-predictor/src0% | 0% | 0% | 48% | 51%
models/model-a/src/code0% | 0% | 0% | 28% | 71%
lib/base0% | 0% | 0% | 0% | 100%
lib/utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def put_metric()
in codes/lambda/api-testing-tester/src/http_request_tester.py
46 3 6
def request_post()
in codes/lambda/api-testing-tester/src/http_request_tester.py
27 4 7
def handle()
in codes/lambda/api-testing-tester/src/handler.py
27 2 2
def execute_tests()
in codes/lambda/api-testing-tester/src/http_request_tester.py
25 7 2
def predict()
in codes/lambda/api-hosting-predictor/src/handler.py
12 2 3
def handle()
in codes/lambda/api-hosting-predictor/src/handler.py
12 3 2
def predict_fn()
in models/model-a/src/code/inference.py
11 2 2
def __init__()
in codes/lambda/api-testing-tester/src/http_request_tester.py
10 1 2
protected createS3Bucket()
in lib/base/base-stack.ts
9 1 1
def model_fn()
in models/model-a/src/code/inference.py
9 1 1
def input_fn()
in models/model-a/src/code/inference.py
9 3 2
def output_fn()
in models/model-a/src/code/inference.py
9 2 2
protected putParameter()
in lib/base/base-stack.ts
8 1 2
def start_loop()
in codes/lambda/api-testing-tester/src/http_request_tester.py
7 3 2
function addProjectPrefix()
in lib/utils/config-loaders.ts
7 2 1
protected getParameter()
in lib/base/base-stack.ts
7 1 1
constructor()
in lib/base/base-stack.ts
6 1 4
def get_client()
in codes/lambda/api-hosting-predictor/src/handler.py
5 2 2
def load_sm_client()
in codes/lambda/api-hosting-predictor/src/handler.py
5 2 0
def create_error_response()
in codes/lambda/api-hosting-predictor/src/handler.py
5 1 2