awslabs / data-transfer-hub
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 64 units with 2,120 lines of code in units (19.6% of code).
    • 4 very long units (991 lines of code)
    • 3 long units (187 lines of code)
    • 22 medium size units (636 lines of code)
    • 10 small units (176 lines of code)
    • 25 very small units (130 lines of code)
46% | 8% | 30% | 8% | 6%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts68% | 4% | 19% | 2% | 3%
js0% | 18% | 51% | 10% | 19%
tsx0% | 17% | 53% | 26% | 2%
py0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/constructs/lib93% | 0% | 4% | 1% | <1%
source/custom-resource0% | 45% | 23% | 0% | 30%
source/portal/src/store0% | 86% | 0% | 0% | 13%
source/portal/src/pages0% | 19% | 50% | 29% | 1%
source/custom-resource/lib0% | 0% | 67% | 21% | 11%
source/portal/src/graphql0% | 0% | 91% | 0% | 8%
source/portal/src0% | 0% | 87% | 12% | 0%
source/constructs/lambda/api0% | 0% | 74% | 20% | 5%
source/custom-resource/lib/usage-metrics0% | 0% | 91% | 0% | 8%
source/portal/src/common0% | 0% | 88% | 0% | 11%
source/constructs/lambda/custom-resource0% | 0% | 0% | 100% | 0%
source/constructs/lambda0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in source/constructs/lib/cfn-step-functions.ts
405 1 3
constructor()
in source/constructs/lib/api-stack.ts
325 5 3
constructor()
in source/constructs/lib/portal-stack.ts
148 3 3
constructor()
in source/constructs/lib/constructs-stack.ts
113 13 3
Launch: moment()
in source/custom-resource/index.js
69 6 0
export default function reducer()
in source/portal/src/store/Reducer.ts
66 11 2
async function fetchNotes()
in source/portal/src/pages/detail/DetailS3.tsx
52 15 1
constructor()
in source/constructs/lib/task-cluster.ts
50 2 3
async function stopTask()
in source/constructs/lambda/api/api-task.ts
41 3 1
async function getTaskList()
in source/portal/src/pages/list/TaskList.tsx
39 9 2
_uploadFile()
in source/custom-resource/lib/s3-helper.js
37 3 4
let sendResponse = function()
in source/custom-resource/index.js
36 2 6
function registerValidSW()
in source/portal/src/serviceWorker.ts
33 8 2
sendAnonymousMetric()
in source/custom-resource/lib/usage-metrics/metrics.common.js
32 2 1
copyAssets()
in source/custom-resource/lib/s3-helper.js
31 3 4
async function createTask()
in source/constructs/lambda/api/api-task.ts
29 1 1
putConfigFile()
in source/custom-resource/lib/s3-helper.js
28 2 3
_downloadManifest()
in source/custom-resource/lib/s3-helper.js
28 4 2
async function fetchNotes()
in source/portal/src/pages/detail/DetailECR.tsx
26 5 1
function checkValidServiceWorker()
in source/portal/src/serviceWorker.ts
25 4 2