microsoft / pxt-ev3
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 820 units with 9,427 lines of code in units (97.6% of code).
    • 3 very long units (351 lines of code)
    • 40 long units (2,662 lines of code)
    • 75 medium size units (2,414 lines of code)
    • 83 small units (1,189 lines of code)
    • 619 very small units (2,811 lines of code)
3% | 28% | 25% | 12% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts6% | 8% | 20% | 17% | 46%
swift0% | 62% | 31% | 4% | 2%
js0% | 54% | 33% | 0% | 12%
cpp0% | 0% | 36% | 22% | 40%
tsx0% | 0% | 50% | 8% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sim/state29% | 7% | 12% | 3% | 47%
sim/visuals6% | 3% | 29% | 15% | 45%
legoresources0% | 62% | 31% | 4% | 2%
fieldeditors0% | 45% | 12% | 24% | 17%
scripts0% | 41% | 38% | 0% | 19%
libs/core0% | 5% | 20% | 25% | 48%
editor0% | 12% | 31% | 21% | 34%
libs/music0% | 0% | 31% | 27% | 40%
libs/color-sensor0% | 0% | 30% | 0% | 69%
libs/screen0% | 0% | 27% | 22% | 49%
sim0% | 0% | 0% | 46% | 53%
libs/infrared-sensor0% | 0% | 0% | 16% | 83%
libs/ev30% | 0% | 0% | 20% | 79%
libs/storage0% | 0% | 0% | 13% | 86%
libs/gyro-sensor0% | 0% | 0% | 36% | 63%
libs/ultrasonic-sensor0% | 0% | 0% | 0% | 100%
libs/touch-sensor0% | 0% | 0% | 0% | 100%
libs/broadcast0% | 0% | 0% | 0% | 100%
libs/datalog0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in sim/state/output.ts
123 25 0
private position()
in sim/visuals/layoutView.ts
121 14 0
private updateStateStep()
in sim/state/motornode.ts
107 33 1
public showEditor_()
in fieldeditors/field_brickbuttons.ts
85 3 0
func measureUltrasonicCentimeters()
in legoresources/RobotAPI.swift
82 1 1
func measureUltrasonicInches()
in legoresources/RobotAPI.swift
81 1 1
func measureGyroAngle()
in legoresources/RobotAPI.swift
80 1 1
func measureGyroRate()
in legoresources/RobotAPI.swift
79 1 1
function compressImg()
in scripts/rgf2png.js
79 10 1
func resetGyro()
in legoresources/RobotAPI.swift
78 1 1
func measureTouch()
in legoresources/RobotAPI.swift
77 1 1
func measureTouchCount()
in legoresources/RobotAPI.swift
76 1 1
func resetTouchCount()
in legoresources/RobotAPI.swift
75 1 1
func measureLightColor()
in legoresources/RobotAPI.swift
74 1 1
func measureLightReflection()
in legoresources/RobotAPI.swift
73 1 1
func measureLightAmbient()
in legoresources/RobotAPI.swift
72 1 1
func measureIRProximity()
in legoresources/RobotAPI.swift
71 1 1
func measureIRSeek()
in legoresources/RobotAPI.swift
70 1 1
func measureMotorDegrees()
in legoresources/RobotAPI.swift
69 1 1
refreshOptions()
in fieldeditors/field_music.ts
68 10 2