microsoft / vscode
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 31,671 units with 388,904 lines of code in units (61.6% of code).
    • 179 very long units (28,880 lines of code)
    • 788 long units (52,154 lines of code)
    • 3,611 medium size units (109,307 lines of code)
    • 6,406 small units (92,962 lines of code)
    • 20,687 very small units (105,601 lines of code)
7% | 13% | 28% | 23% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts7% | 13% | 27% | 23% | 27%
js6% | 16% | 32% | 23% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/vs7% | 13% | 27% | 23% | 27%
extensions/emmet18% | 8% | 44% | 18% | 10%
extensions/git6% | 12% | 31% | 23% | 24%
build42% | 4% | 32% | 7% | 12%
extensions/json-language-features31% | 11% | 24% | 16% | 16%
extensions/html-language-features11% | 11% | 31% | 29% | 16%
build/lib3% | 21% | 37% | 20% | 16%
extensions/css-language-features25% | 0% | 36% | 22% | 15%
extensions/github39% | 21% | 15% | 13% | 10%
src19% | 25% | 13% | 28% | 12%
extensions/typescript-language-features1% | 8% | 29% | 32% | 28%
build/azure-pipelines0% | 37% | 35% | 15% | 11%
extensions/npm0% | 13% | 30% | 34% | 21%
extensions/search-result0% | 77% | 19% | 0% | 2%
extensions/php-language-features0% | 26% | 32% | 20% | 20%
extensions/microsoft-authentication0% | 15% | 43% | 19% | 21%
extensions/merge-conflict0% | 15% | 39% | 17% | 27%
extensions/github-authentication0% | 14% | 36% | 26% | 22%
extensions/theme-seti0% | 32% | 21% | 38% | 8%
extensions/extension-editing0% | 27% | 20% | 19% | 31%
extensions/ipynb0% | 13% | 19% | 48% | 18%
extensions/configuration-editing0% | 14% | 47% | 12% | 25%
build/npm0% | 37% | 24% | 34% | 3%
extensions/grunt0% | 24% | 7% | 32% | 34%
extensions/debug-auto-launch0% | 35% | 12% | 37% | 14%
build/darwin0% | 30% | 62% | 7% | 0%
extensions/jake0% | 22% | 7% | 29% | 40%
extensions/gulp0% | 18% | 14% | 28% | 38%
extensions/simple-browser0% | 19% | 11% | 19% | 49%
extensions/markdown-language-features0% | 0% | 27% | 38% | 34%
scripts0% | 0% | 75% | 19% | 5%
extensions/git-base0% | 0% | 27% | 30% | 42%
extensions/image-preview0% | 0% | 18% | 41% | 39%
extensions/debug-server-ready0% | 0% | 32% | 36% | 30%
build/builtin0% | 0% | 42% | 30% | 27%
extensions/markdown-math0% | 0% | 61% | 0% | 38%
extensions/php0% | 0% | 58% | 21% | 19%
extensions0% | 0% | 64% | 35% | 0%
build/linux0% | 0% | 0% | 100% | 0%
extensions/typescript-basics0% | 0% | 0% | 52% | 47%
extensions/html0% | 0% | 0% | 100% | 0%
extensions/json0% | 0% | 0% | 63% | 36%
build/monaco0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export function registerTerminalActions()
in src/vs/workbench/contrib/terminal/browser/terminalActions.ts
940 53 0
export function createApiFactoryAndRegisterActors()
in src/vs/workbench/api/common/extHost.api.impl.ts
737 29 1
async function webviewPreloads()
in src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts
579 102 1
export function setupTerminalMenus()
in src/vs/workbench/contrib/terminal/browser/terminalMenus.ts
439 1 0
private registerGlobalActions()
in src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
420 1 0
description: localize()
in src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts
394 30 2
export function startServer()
in extensions/html-language-features/server/src/htmlServer.ts
358 107 2
export function createExtHostComments()
in src/vs/workbench/api/common/extHostComments.ts
330 47 3
function getMenuWidgetCSS()
in src/vs/base/browser/ui/menu/menu.ts
320 5 1
private _initialize()
in src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
301 72 1
identifiers: overrideIdentifiersFromKey()
in src/vs/platform/configuration/common/configurationModels.ts
280 57 1
(function ()()
in src/vs/base/common/keyCodes.ts
276 18 1
private _buildDomNode()
in src/vs/editor/contrib/find/browser/findWidget.ts
269 37 0
private registerListeners()
in src/vs/workbench/contrib/debug/browser/debugSession.ts
252 81 0
constructor()
in src/vs/editor/common/config/editorOptions.ts
250 1 0
export function startServer()
in extensions/json-language-features/server/src/jsonServer.ts
249 56 2
export function createExtHostQuickOpen()
in src/vs/workbench/api/common/extHostQuickOpen.ts
244 30 3
constructor()
in src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
244 54 3
export function registerColors()
in src/vs/workbench/contrib/debug/browser/debugColors.ts
242 14 0
export async function main()
in src/vs/code/node/cli.ts
233 51 1