awslabs / photo-search-on-aws
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 20 units with 824 lines of code in units (24.2% of code).
    • 2 very long units (537 lines of code)
    • 1 long units (56 lines of code)
    • 4 medium size units (130 lines of code)
    • 3 small units (42 lines of code)
    • 10 very small units (59 lines of code)
65% | 6% | 15% | 5% | 7%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts68% | 7% | 16% | 1% | 6%
js0% | 0% | 0% | 61% | 38%
tsx0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/backend/lib79% | 8% | 11% | 0% | <1%
source/frontend/src/services0% | 0% | 58% | 0% | 41%
deployment/cdk-solution-helper0% | 0% | 0% | 61% | 38%
source/backend/lambda/custom-resources0% | 0% | 0% | 100% | 0%
source/frontend/src0% | 0% | 0% | 100% | 0%
source/frontend/src/hooks0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in source/backend/lib/cdk-photosearch-backend-stack.ts
405 7 3
constructor()
in source/backend/lib/cdk-photosearch-web-stack.ts
132 2 3
constructor()
in source/backend/lib/privateapi.ts
56 1 3
constructor()
in source/backend/lib/cdk-photosearch-stack.ts
39 1 2
makeLambdaRole()
in source/backend/lib/cdk-photosearch-backend-stack.ts
38 1 1
public async uploadForRegister()
in source/frontend/src/services/photo-service.ts
27 3 1
public async upload()
in source/frontend/src/services/photo-service.ts
26 4 1
function setParameter()
in deployment/cdk-solution-helper/index.js
16 3 1
for await()
in source/backend/lambda/custom-resources/frontend-event-handler/index.ts
15 4 1
custom_header: async()
in source/frontend/src/index.tsx
11 2 0
function assetRef()
in deployment/cdk-solution-helper/index.js
10 2 1
public searchByName()
in source/frontend/src/services/photo-service.ts
9 1 3
public setName()
in source/frontend/src/services/name-service.ts
8 1 2
page: Number()
in source/frontend/src/hooks/query/query-hook.ts
8 2 1
public getSimilarPhotos()
in source/frontend/src/services/photo-service.ts
7 1 2
public setTags()
in source/frontend/src/services/photo-service.ts
5 1 2
public static getService()
in source/frontend/src/services/service-factory.ts
3 1 1
public getPhotoUrl()
in source/frontend/src/services/photo-service.ts
3 1 1
public detectFaces()
in source/frontend/src/services/photo-service.ts
3 1 1
private getAssetSourceBucketName()
in source/backend/lib/cdk-photosearch-web-stack.ts
3 1 0