microsoft / monaco-editor
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 407 units with 7,387 lines of code in units (17.5% of code).
    • 9 very long units (1,814 lines of code)
    • 14 long units (924 lines of code)
    • 61 medium size units (1,928 lines of code)
    • 103 small units (1,518 lines of code)
    • 220 very small units (1,203 lines of code)
24% | 12% | 26% | 20% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js42% | 12% | 21% | 12% | 10%
ts8% | 12% | 30% | 27% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
website/playground51% | 10% | 16% | 9% | 12%
src/basic-languages86% | 0% | 0% | 6% | 6%
build19% | 19% | 37% | 14% | 7%
src/common11% | 19% | 31% | 31% | 5%
src/json22% | 14% | 4% | 29% | 29%
src/typescript7% | 3% | 52% | 15% | 20%
src/css0% | 22% | 8% | 37% | 31%
ROOT0% | 100% | 0% | 0% | 0%
src/html0% | 19% | 10% | 42% | 26%
website/monarch0% | 0% | 40% | 28% | 30%
website/index0% | 0% | 22% | 30% | 47%
webpack-plugin/src0% | 0% | 0% | 49% | 50%
build/npm0% | 0% | 0% | 100% | 0%
build/fillers0% | 0% | 0% | 57% | 42%
src/fillers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
provideDocumentSymbols: function()
in website/playground/new-samples/extending-language-services/symbols-provider-example/sample.js
472 1 2
function getMicrosoftSQLKeywords()
in src/basic-languages/sql/keywords.js
427 1 0
(function ()()
in website/playground/new-samples/all.js
183 2 1
function getSQLiteKeywords()
in src/basic-languages/sql/keywords.js
154 1 0
function generateTestSamplesTask()
in build/simpleserver.js
126 2 0
range: toRange()
in src/common/lspLanguageFeatures.ts
115 10 1
(function ()()
in build/importTypescript.js
113 7 1
function tokenize()
in src/json/tokenization.ts
113 24 4
value: displayPartsToString()
in src/typescript/languageFeatures.ts
111 4 1
function registerProviders()
in src/css/cssMode.ts
83 12 0
(function ()()
in metadata.js
81 2 1
function load()
in website/playground/playground.js
79 10 0
function generateMetadata()
in build/releaseMetadata.js
73 8 0
function registerProviders()
in src/html/htmlMode.ts
72 11 0
function registerProviders()
in src/json/jsonMode.ts
71 11 0
kind: toSymbolKind()
in src/common/lspLanguageFeatures.ts
66 20 1
range: toRange()
in src/common/lspLanguageFeatures.ts
65 20 1
kind: toDocumentHighlightKind()
in src/common/lspLanguageFeatures.ts
62 6 1
function getFeatures()
in build/releaseMetadata.js
59 10 0
function escapeText()
in build/importTypescript.js
56 12 1