aws-samples / aws-bookstore-demo-app
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 72 units with 851 lines of code in units (9.1% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (52 lines of code)
    • 11 medium size units (297 lines of code)
    • 17 small units (234 lines of code)
    • 43 very small units (268 lines of code)
0% | 6% | 34% | 27% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx0% | 8% | 28% | 25% | 37%
ts0% | 0% | 90% | 0% | 9%
js0% | 0% | 35% | 35% | 28%
py0% | 0% | 35% | 64% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
assets/src/modules/signup0% | 39% | 26% | 20% | 14%
assets/src0% | 0% | 90% | 0% | 9%
assets/src/modules/cart0% | 0% | 41% | 26% | 32%
functions/setup0% | 0% | 35% | 35% | 28%
assets/src/modules/pastPurchases0% | 0% | 40% | 18% | 40%
assets/src/modules/checkout0% | 0% | 38% | 37% | 24%
assets/src/modules/bestSellers0% | 0% | 37% | 25% | 37%
assets/src/modules/search0% | 0% | 48% | 0% | 52%
functions/APIs0% | 0% | 43% | 56% | 0%
assets/src/modules/category0% | 0% | 0% | 40% | 59%
assets/src/common/friendRecommendations0% | 0% | 0% | 53% | 46%
assets/src/modules/friends0% | 0% | 0% | 31% | 68%
functions/streaming0% | 0% | 0% | 100% | 0%
assets/src/common0% | 0% | 0% | 0% | 100%
assets/src/common/starRating0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
renderLanding()
in assets/src/modules/signup/Home.tsx
52 14 0
render()
in assets/src/modules/cart/CartProductRow.tsx
38 3 0
renderHome()
in assets/src/modules/signup/Home.tsx
35 1 0
function sendResponse()
in functions/setup/uploadBooks.js
34 1 5
render()
in assets/src/modules/pastPurchases/PastPurchases.tsx
28 4 0
render()
in assets/src/modules/checkout/CheckoutConfirm.tsx
24 2 0
render()
in assets/src/modules/bestSellers/BestSellerProductRow.tsx
24 2 0
async componentDidMount()
in assets/src/modules/search/SearchGallery.tsx
24 5 0
function registerValidSW()
in assets/src/registerServiceWorker.ts
23 4 1
def handler()
in functions/APIs/search.py
23 3 2
export default function register()
in assets/src/registerServiceWorker.ts
22 5 0
function checkValidServiceWorker()
in assets/src/registerServiceWorker.ts
22 3 1
function uploadBooksData()
in functions/setup/uploadBooks.js
20 3 1
render()
in assets/src/common/friendRecommendations/FriendRecommendations.tsx
16 6 0
async componentDidMount()
in assets/src/modules/bestSellers/BestSellers.tsx
16 3 0
constructor()
in assets/src/modules/signup/Signup.tsx
16 1 1
render()
in assets/src/modules/category/CategoryGalleryTeaser.tsx
15 2 0
def handler()
in functions/APIs/getRecommendations.py
15 1 2
def handler()
in functions/APIs/getRecommendationsByBook.py
15 1 2
function putItem()
in functions/setup/uploadBooks.js
14 1 1