microsoft / pxt-arcade
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 479 units with 5,133 lines of code in units (52.0% of code).
    • 3 very long units (869 lines of code)
    • 8 long units (473 lines of code)
    • 33 medium size units (926 lines of code)
    • 82 small units (1,162 lines of code)
    • 353 very small units (1,703 lines of code)
16% | 9% | 18% | 22% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts19% | 6% | 13% | 24% | 35%
tsx19% | 14% | 20% | 13% | 31%
cpp0% | 17% | 39% | 27% | 15%
js0% | 0% | 37% | 28% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
share/src18% | 9% | 16% | 21% | 33%
editor66% | 0% | 0% | 13% | 20%
libs/hw---vm0% | 30% | 27% | 33% | 8%
libs/hw---rpi0% | 0% | 60% | 21% | 17%
libs/template0% | 0% | 48% | 13% | 38%
libs/corgio0% | 0% | 53% | 0% | 46%
libs/sevenseg0% | 0% | 0% | 49% | 50%
scripts0% | 0% | 0% | 80% | 19%
libs/darts0% | 0% | 0% | 55% | 44%
libs/screen---st77350% | 0% | 0% | 0% | 100%
libs/storage0% | 0% | 0% | 0% | 100%
libs/game0% | 0% | 0% | 0% | 100%
libs/screen---ext0% | 0% | 0% | 0% | 100%
libs/screen---linux0% | 0% | 0% | 0% | 100%
libs/screen0% | 0% | 0% | 0% | 100%
libs/device0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function setupFrames()
in share/src/games/bunny_hop/main.ts.ts
526 1 0
data: imageLiteralToBitmap()
in share/src/components/GameModder.tsx
232 17 1
function patchBlocks()
in editor/extension.ts
111 25 2
void handle_touch_events()
in libs/hw---vm/sdlmain.cpp
73 28 1
protected buildDom()
in share/src/sprite-editor/buttons.ts
63 1 0
protected setHandlePosition()
in share/src/components/Joystick.tsx
62 17 3
default: textToBitmap()
in share/src/components/GameModder.tsx
60 7 1
constructor()
in share/src/sprite-editor/spriteEditor.ts
57 10 4
render()
in share/src/components/GameModder.tsx
55 3 0
export function imageLiteralToBitmap()
in share/src/sprite-editor/bitmap.ts
52 45 2
function httpRequestCoreAsync()
in share/src/components/util.ts
51 14 1
function makeCodeRun()
in libs/template/assets/js/loader.js
48 11 1
int mapKeyCode()
in libs/hw---vm/sdlmain.cpp
44 24 1
export function shareScriptAsync()
in share/src/components/util.ts
38 3 3
protected bindTouchEvents()
in share/src/components/Joystick.tsx
37 7 1
int pressureLevelByButtonId()
in libs/hw---rpi/keys.cpp
35 10 2
protected bindTouchEvents()
in share/src/components/GameButtons.tsx
35 7 1
constructor()
in share/src/components/GameModder.tsx
34 3 1
function drawRightButton()
in share/src/sprite-editor/buttons.ts
32 1 5
export function f4PreProcess()
in share/src/bitmap_helpers.ts
31 8 1