microsoft / pxt-calliope
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 736 units with 7,236 lines of code in units (63.4% of code).
    • 2 very long units (402 lines of code)
    • 8 long units (557 lines of code)
    • 83 medium size units (2,606 lines of code)
    • 77 small units (1,169 lines of code)
    • 566 very small units (2,502 lines of code)
5% | 7% | 36% | 16% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts9% | 11% | 26% | 12% | 40%
cs22% | 12% | 21% | 7% | 35%
js0% | 2% | 62% | 21% | 13%
tsx0% | 34% | 49% | 0% | 15%
cpp0% | 0% | 8% | 22% | 68%
h0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
libs/core14% | 2% | 18% | 15% | 48%
clients/winuploader22% | 12% | 21% | 7% | 35%
editor0% | 41% | 31% | 7% | 19%
sim/visuals0% | 16% | 47% | 18% | 17%
sim0% | 55% | 20% | 14% | 10%
editor/prepend0% | 2% | 63% | 20% | 13%
sim/state0% | 0% | 14% | 14% | 70%
libs/lang-test10% | 0% | 72% | 0% | 27%
libs/radio0% | 0% | 27% | 16% | 56%
libs/bluetooth0% | 0% | 0% | 23% | 76%
pxtwapp/pxtwapp0% | 0% | 0% | 57% | 42%
libs/devices0% | 0% | 0% | 0% | 100%
fieldeditors0% | 0% | 0% | 0% | 100%
clients/macuploader0% | 0% | 0% | 0% | 100%
libs/cpp-test0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export function iconImage()
in libs/core/icons.ts
299 49 1
private void InitializeComponent()
in clients/winuploader/Microbit.Uploader/MainForm.Designer.cs
103 1 0
89 21 2
86 8 1
private buildDom()
in sim/visuals/microbit.ts
79 5 0
constructor()
in sim/dalboard.ts
66 1 0
62 1 3
void handleFile()
in clients/winuploader/Microbit.Uploader/MainForm.cs
59 18 1
export function arrowImage()
in libs/core/icons.ts
59 9 1
57 4 2
private instantaneousPosture()
in sim/state/accelerometer.ts
49 24 0
void gcProcessStacks()
in libs/core/codal.cpp
48 13 1
47 20 3
46 4 0
46 13 3
FlashProgram.fromIntelHex = function()
in editor/prepend/dapjs.js
46 10 1
export function getMelody()
in libs/core/melodies.ts
46 21 1
function playNextNote()
in libs/core/music.ts
46 30 1
private void InitializeComponent()
in clients/winuploader/Microbit.Uploader/LicenseDialog.Designer.cs
44 1 0
DAP.prototype.init = function()
in editor/prepend/dapjs.js
44 10 0