aws-solutions / serverless-image-handler
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 73 units with 2,077 lines of code in units (71.5% of code).
    • 4 very long units (671 lines of code)
    • 4 long units (235 lines of code)
    • 22 medium size units (727 lines of code)
    • 21 small units (326 lines of code)
    • 22 very small units (118 lines of code)
32% | 11% | 35% | 15% | 5%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts33% | 8% | 36% | 15% | 5%
js0% | 65% | 0% | 29% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
image-handler34% | 5% | 39% | 15% | 4%
constructs/lib100% | 0% | 0% | 0% | 0%
constructs/lib/back-end100% | 0% | 0% | 0% | 0%
custom-resource0% | 15% | 70% | 8% | 5%
constructs/lib/common-resources0% | 29% | 21% | 44% | 5%
demo-ui0% | 65% | 0% | 29% | 5%
constructs/lib/front-end0% | 0% | 100% | 0% | 0%
solution-utils0% | 0% | 0% | 40% | 59%
constructs/utils0% | 0% | 0% | 52% | 47%
custom-resource/lib0% | 0% | 0% | 0% | 100%
image-handler/lib0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in source/constructs/lib/serverless-image-stack.ts
227 4 3
public mapFilter()
in source/image-handler/thumbor-mapper.ts
168 41 3
public async applyEdits()
in source/image-handler/image-handler.ts
150 47 2
constructor()
in source/constructs/lib/back-end/back-end-construct.ts
126 1 3
export async function handler()
in source/custom-resource/index.ts
66 18 2
constructor()
in source/constructs/lib/common-resources/custom-resources/custom-resource-construct.ts
58 1 3
function getPreviewImage()
in source/demo-ui/scripts.js
58 18 0
export async function handler()
in source/image-handler/index.ts
53 10 1
async function createCloudFrontLoggingBucket()
in source/custom-resource/index.ts
50 5 1
async function copyS3Assets()
in source/custom-resource/index.ts
49 6 1
public async setup()
in source/image-handler/image-request.ts
48 23 1
async function sendAnonymousMetric()
in source/custom-resource/index.ts
43 3 2
constructor()
in source/constructs/lib/common-resources/common-resources-construct.ts
42 1 3
async process()
in source/image-handler/image-handler.ts
38 11 1
public async getOverlayImage()
in source/image-handler/image-handler.ts
36 7 6
public async getBoundingBox()
in source/image-handler/image-handler.ts
35 11 2
public async getOriginalImage()
in source/image-handler/image-request.ts
34 7 2
async function checkSecretsManager()
in source/custom-resource/index.ts
33 7 1
async function putConfigFile()
in source/custom-resource/index.ts
32 5 1
async function checkFallbackImage()
in source/custom-resource/index.ts
31 7 1