awslabs / amazon-translate-browser-extension
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 36 units with 375 lines of code in units (4.1% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 6 medium size units (162 lines of code)
    • 7 small units (104 lines of code)
    • 23 very small units (109 lines of code)
0% | 0% | 43% | 27% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 0% | 43% | 27% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/contentScripts0% | 0% | 44% | 33% | 22%
src0% | 0% | 93% | 0% | 6%
ROOT0% | 0% | 29% | 23% | 46%
scripts0% | 0% | 0% | 54% | 45%
src/util0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
41 3 0
function messageHandler()
in src/contentScripts/index.ts
26 1 0
25 2 1
async function startTranslation()
in src/contentScripts/index.ts
25 3 4
export async function translateDocuments()
in src/contentScripts/functions.ts
23 3 4
function translateDocument()
in src/contentScripts/functions.ts
22 2 3
export default defineConfig()
in vite.config.content.ts
20 2 2
async function sendDocumentsToTranslate()
in src/contentScripts/functions.ts
19 1 4
export function bindPages()
in src/contentScripts/functions.ts
15 2 1
export function cacheTranslation()
in src/contentScripts/functions.ts
13 1 4
export function applyCachedTranslation()
in src/contentScripts/functions.ts
13 3 3
export function applyTranslation()
in src/contentScripts/functions.ts
12 4 2
async function stubIndexHtml()
in scripts/prepare.ts
12 2 0
outDir: r()
in vite.config.content.ts
9 2 1
export function validNodeText()
in src/contentScripts/functions.ts
9 4 1
export function breakPages()
in src/contentScripts/functions.ts
8 1 1
export function breakDocuments()
in src/contentScripts/functions.ts
7 2 1
7 1 4
root: r()
in vite.config.ts
6 1 1
outDir: r()
in vite.config.ts
6 2 1