microsoft / pxt-chibitronics
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 267 units with 2,103 lines of code in units (57.0% of code).
    • 1 very long units (110 lines of code)
    • 3 long units (174 lines of code)
    • 15 medium size units (468 lines of code)
    • 29 small units (385 lines of code)
    • 219 very small units (966 lines of code)
5% | 8% | 22% | 18% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts7% | 11% | 26% | 16% | 37%
cpp0% | 0% | 14% | 24% | 60%
h0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
editor30% | 17% | 19% | 19% | 13%
sim/visuals0% | 22% | 45% | 17% | 15%
libs/core0% | 0% | 12% | 26% | 60%
sim/state0% | 0% | 12% | 0% | 87%
sim0% | 0% | 42% | 0% | 57%
libs/scope0% | 0% | 0% | 0% | 100%
windowsapp0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
110 6 1
function renderWave()
in editor/extension.ts
63 7 1
private updatePin()
in sim/visuals/ltc.ts
57 24 2
private updateSerial()
in sim/visuals/ltc.ts
54 10 0
export function mkNeoPixelPart()
in sim/visuals/neopixel.ts
48 1 2
private mkCrocEnd()
in sim/visuals/ltc.ts
47 5 4
44 1 1
export function mkBtnSvg()
in sim/state/buttonpairsim.ts
36 1 1
private updateTemperature()
in sim/visuals/ltc.ts
33 4 0
static void pinPollThread()
in libs/core/input.cpp
32 10 1
constructor()
in sim/ltcboard.ts
30 1 0
static void registerEvent()
in libs/core/input.cpp
29 8 3
private updateRgbLed()
in sim/visuals/ltc.ts
27 8 0
public update()
in sim/visuals/neopixel.ts
27 8 1
function ltcIhexToBinary()
in editor/extension.ts
26 6 1
points: mkPnts()
in sim/visuals/ltc.ts
24 1 3
int RefCollection::indexOf()
in libs/core/RefCollection.cpp
23 8 2
export function sos()
in libs/core/lights.ts
21 4 2
public init()
in sim/visuals/neopixel.ts
21 1 4
export function effect()
in libs/core/lights.ts
20 9 3