microsoft / pxt-adafruit
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 72 units with 1,220 lines of code in units (3.1% of code).
    • 0 very long units (0 lines of code)
    • 7 long units (478 lines of code)
    • 6 medium size units (197 lines of code)
    • 19 small units (297 lines of code)
    • 40 very small units (248 lines of code)
0% | 39% | 16% | 24% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 38% | 18% | 21% | 21%
tsx0% | 75% | 0% | 24% | 0%
js0% | 0% | 0% | 57% | 42%
cpp0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sim/visuals0% | 40% | 18% | 22% | 18%
fieldeditors0% | 59% | 0% | 19% | 20%
sim0% | 59% | 0% | 17% | 22%
editor0% | 75% | 0% | 24% | 0%
libs/circuit-playground0% | 0% | 66% | 28% | 5%
libs/light0% | 0% | 38% | 39% | 22%
pxtwapp/pxtwapp0% | 0% | 0% | 57% | 42%
libs/cptest0% | 0% | 0% | 27% | 72%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
initRing()
in fieldeditors/field_lights.ts
97 8 0
private buildDom()
in sim/visuals/board.ts
74 7 0
private updateTemperature()
in sim/visuals/board.ts
71 13 0
constructor()
in sim/dalboard.ts
60 1 0
private updateLightLevel()
in sim/visuals/board.ts
60 12 0
private updateSoundLevel()
in sim/visuals/board.ts
60 12 0
56 5 3
export function ambientColor()
in libs/circuit-playground/input.ts
47 4 0
private addButtonEvents()
in sim/visuals/pincontrol.ts
39 6 0
private updateGestures()
in sim/visuals/board.ts
35 3 0
export function defaultStrip()
in libs/light/defaultstrip.ts
27 7 0
private updateNeoPixels()
in sim/visuals/board.ts
26 10 0
public updateState()
in sim/visuals/board.ts
23 6 0
static void showCode()
in libs/circuit-playground/panic.cpp
20 6 1
function initialize()
in pxtwapp/pxtwapp/msapp-error.js
20 3 0
private mkBtn()
in sim/visuals/board.ts
19 1 3
header: lf()
in editor/extension.tsx
18 3 1
render_()
in fieldeditors/field_lights.ts
18 9 0
receiveMessage()
in sim/dalboard.ts
18 8 1
private updatePin()
in sim/visuals/board.ts
18 8 2