microsoft / pxt-maker
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 76 units with 716 lines of code in units (22.6% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (147 lines of code)
    • 3 medium size units (77 lines of code)
    • 12 small units (172 lines of code)
    • 59 very small units (320 lines of code)
0% | 20% | 10% | 24% | 44%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts0% | 20% | 10% | 24% | 44%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sim0% | 64% | 0% | 9% | 26%
sim/visuals0% | 25% | 23% | 24% | 26%
libs/bead-drivers0% | 0% | 9% | 22% | 67%
libs/bead-motion0% | 0% | 0% | 81% | 18%
libs/brain-nrf528400% | 0% | 0% | 56% | 43%
libs/bead-brain0% | 0% | 0% | 0% | 100%
libs/sparkfun-redboard-turbo0% | 0% | 0% | 0% | 100%
libs/adafruit-neotrellis-m4-express0% | 0% | 0% | 0% | 100%
libs/machachi0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in sim/dalboard.ts
91 22 1
constructor()
in sim/visuals/board.ts
56 21 1
constructor()
in sim/visuals/board.ts
27 4 1
export function pauseSensorForIntegrationTime()
in libs/bead-drivers/TCS34725.ts
25 6 1
constructor()
in sim/visuals/board.ts
25 3 1
init()
in libs/bead-drivers/VL53L0X.ts
19 1 0
height: scaleFn()
in sim/visuals/board.ts
19 1 1
function init()
in libs/brain-nrf52840/platform.ts
18 4 0
export function getRawLuminosity()
in libs/bead-drivers/TSL2591.ts
17 3 0
function stepUpdate()
in libs/bead-motion/gesture.ts
13 4 0
function lightStepUpdate()
in libs/bead-motion/gesture.ts
13 4 0
13 5 2
public updateState()
in sim/visuals/board.ts
13 5 0
export function initSensor()
in libs/bead-drivers/PCA9632.ts
12 1 0
export function configureSensor()
in libs/bead-drivers/TSL2591.ts
12 2 2
public init()
in sim/visuals/buttons.ts
12 1 4
11 1 1
export function startServices()
in libs/bead-brain/light.ts
10 1 0
export function pinByName()
in sim/dalboard.ts
10 3 1
private addDefs()
in sim/visuals/board.ts
10 1 1