aws-samples / aws-serverless-shopping-cart
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 27 units with 473 lines of code in units (19.6% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (137 lines of code)
    • 5 medium size units (158 lines of code)
    • 7 small units (85 lines of code)
    • 13 very small units (93 lines of code)
0% | 28% | 33% | 17% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 36% | 36% | 13% | 14%
js0% | 0% | 22% | 37% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
backend/shopping-cart-service0% | 42% | 42% | 8% | 6%
frontend/src0% | 0% | 24% | 40% | 34%
backend/product-mock-service0% | 0% | 0% | 63% | 36%
backend/layers0% | 0% | 0% | 28% | 71%
frontend/scripts0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def lambda_handler()
in backend/shopping-cart-service/add_to_cart.py
75 8 2
def lambda_handler()
in backend/shopping-cart-service/update_cart.py
62 7 2
def lambda_handler()
in backend/shopping-cart-service/migrate_cart.py
44 7 2
def lambda_handler()
in backend/shopping-cart-service/db_stream_handler.py
33 8 2
def lambda_handler()
in backend/shopping-cart-service/list_cart.py
32 7 2
def lambda_handler()
in backend/shopping-cart-service/checkout_cart.py
28 4 2
async function getHeaders()
in frontend/src/backend/api.js
21 4 1
def update_item()
in backend/shopping-cart-service/migrate_cart.py
15 1 2
export async function postCart()
in frontend/src/backend/api.js
12 1 2
export async function putCart()
in frontend/src/backend/api.js
12 1 2
def lambda_handler()
in backend/product-mock-service/get_product.py
12 3 2
def lambda_handler()
in backend/shopping-cart-service/get_cart_total.py
12 1 2
function getUser()
in frontend/src/router.js
11 3 0
def get_headers()
in backend/layers/shared.py
11 1 1
def lambda_handler()
in backend/shopping-cart-service/delete_from_cart.py
10 2 2
def get_cart_id()
in backend/layers/shared.py
10 2 1
export async function cartMigrate()
in frontend/src/backend/api.js
8 1 0
export async function cartCheckout()
in frontend/src/backend/api.js
8 1 0
function formatParams()
in frontend/scripts/fetchconfig.js
8 3 1
def get_product_from_external_service()
in backend/shopping-cart-service/utils.py
8 2 1