microsoft / fast
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 1,599 units with 16,761 lines of code in units (3.6% of code).
    • 3 very long units (593 lines of code)
    • 22 long units (1,512 lines of code)
    • 145 medium size units (4,354 lines of code)
    • 296 small units (4,341 lines of code)
    • 1,133 very small units (5,961 lines of code)
3% | 9% | 25% | 25% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx34% | 13% | 19% | 18% | 13%
js12% | 21% | 29% | 18% | 17%
ts0% | 7% | 26% | 27% | 38%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/tooling34% | 5% | 26% | 16% | 16%
sites/fast-component-explorer24% | 14% | 28% | 19% | 13%
sites/website39% | 23% | 0% | 20% | 17%
packages/web-components0% | 8% | 23% | 26% | 40%
packages/utilities0% | 6% | 33% | 27% | 32%
build/testing0% | 63% | 0% | 24% | 12%
sites/fast-color-explorer0% | 12% | 31% | 20% | 35%
sites/site-utilities0% | 0% | 59% | 27% | 12%
sites/fast-website0% | 0% | 23% | 33% | 42%
build/releasing0% | 0% | 60% | 32% | 7%
build0% | 0% | 35% | 20% | 43%
build/helpers0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private renderBody()
in packages/tooling/fast-figma-plugin-msft/src/core/ui/index.tsx
349 10 0
public render()
in sites/fast-component-explorer/app/explorer.tsx
124 3 0
async function copyArticleMarkdown()
in sites/website/src/generate-docs.js
120 7 0
public generatePaletteColorScale()
in packages/utilities/fast-colors/src/color-palette.ts
97 10 0
public handleKeyDown()
in packages/web-components/fast-foundation/src/picker/picker.ts
93 22 1
public handleKeydown()
in packages/web-components/fast-foundation/src/data-grid/data-grid.ts
88 22 1
export function quantizeHistogram()
in packages/utilities/fast-colors/src/color-quantization.ts
86 19 2
export function calcSplices()
in packages/web-components/fast-element/src/observation/array-change-records.ts
80 20 6
public register()
in packages/web-components/fast-foundation/src/design-system/design-system.ts
74 13 1
public static fromDefinition()
in packages/web-components/fast-router/src/commands.ts
72 14 2
async function buildAPIMarkdown()
in sites/website/src/generate-docs.js
71 11 0
export function renderDevToolsTabs()
in sites/fast-component-explorer/app/web-components/index.tsx
70 1 1
constructor()
in build/testing/applitools/run-msft-docs.js
68 1 3
function test()
in build/testing/sauce-labs/test-browsers.js
67 1 1
private $add()
in packages/web-components/fast-router/src/recognizer.ts
67 10 2
function mergeSplice()
in packages/web-components/fast-element/src/observation/array-change-records.ts
64 11 4
public compareTo()
in packages/web-components/fast-router/src/recognizer.ts
63 16 1
export const noninteractiveCalendarTemplate:()
in packages/web-components/fast-foundation/src/calendar/calendar.template.ts
61 2 1
public keydownHandler()
in packages/web-components/fast-foundation/src/combobox/combobox.ts
60 15 1
private setupRadioButtons()
in packages/web-components/fast-foundation/src/radio-group/radio-group.ts
59 14 0