cdklabs / construct-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 362 units with 5,904 lines of code in units (64.2% of code).
    • 6 very long units (994 lines of code)
    • 15 long units (1,068 lines of code)
    • 41 medium size units (1,372 lines of code)
    • 77 small units (1,101 lines of code)
    • 223 very small units (1,369 lines of code)
16% | 18% | 23% | 18% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts16% | 18% | 23% | 18% | 23%
js0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/backend13% | 20% | 23% | 20% | 22%
src46% | 8% | 22% | 6% | 15%
src/package-sources14% | 24% | 18% | 17% | 25%
src/webapp0% | 49% | 0% | 36% | 13%
src/codeartifact0% | 0% | 58% | 33% | 7%
src/s30% | 0% | 40% | 37% | 22%
src/monitored-certificate0% | 0% | 55% | 16% | 27%
src/monitoring0% | 0% | 28% | 20% | 50%
ROOT0% | 0% | 0% | 100% | 0%
src/package-tag0% | 0% | 0% | 0% | 100%
src/package-tag-group0% | 0% | 0% | 0% | 100%
src/preload-file0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public constructor()
in src/backend-dashboard.ts
271 4 3
public constructor()
in src/backend/orchestration/index.ts
167 1 3
public bind()
in src/package-sources/code-artifact.ts
149 4 6
public constructor()
in src/backend/orchestration/index.ts
145 1 3
public static osiApproved()
in src/spdx-license.ts
137 1 0
public constructor()
in src/backend/ingestion/index.ts
125 3 3
export function handler()
in src/backend/transliterator/transliterator.ecstask.ts
97 19 1
public constructor()
in src/backend/transliterator/index.ts
94 7 3
public constructor()
in src/webapp/index.ts
89 7 3
private createVpc()
in src/construct-hub.ts
79 7 2
public constructor()
in src/backend/ingestion/index.ts
77 1 3
export async function handler()
in src/backend/catalog-builder/catalog-builder.lambda.ts
76 17 2
private registerAlarms()
in src/package-sources/npmjs.ts
73 1 5
async function appendPackage()
in src/backend/catalog-builder/catalog-builder.lambda.ts
66 9 4
export async function handler()
in src/backend/inventory/package-versions-table-widget-function.lambda.ts
64 6 3
function getRelevantVersionInfos()
in src/package-sources/npmjs/npm-js-follower.lambda.ts
63 16 5
private https()
in src/package-sources/npmjs/couch-changes.lambda-shared.ts
61 10 4
await metricScope()
in src/package-sources/npmjs/npm-js-follower.lambda.ts
59 11 1
public constructor()
in src/backend/inventory/index.ts
57 1 3
for await()
in src/backend/inventory/canary.lambda.ts
57 16 1