microsoft / pxt-common-packages
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 3,357 units with 30,358 lines of code in units (65.1% of code).
    • 3 very complex units (606 lines of code)
    • 3 complex units (385 lines of code)
    • 111 medium complex units (5,410 lines of code)
    • 225 simple units (5,263 lines of code)
    • 3,015 very simple units (18,694 lines of code)
1% | 1% | 17% | 17% | 61%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cpp3% | 1% | 21% | 19% | 54%
ts1% | 1% | 15% | 15% | 66%
js0% | 0% | 46% | 19% | 34%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
libs/core---vm15% | 0% | 12% | 18% | 53%
libs/mixer27% | 0% | 18% | 11% | 42%
libs/screen8% | 0% | 27% | 12% | 51%
libs/game0% | 3% | 21% | 17% | 57%
libs/screen---linux0% | 61% | 0% | 12% | 25%
libs/screen---st77350% | 13% | 21% | 21% | 43%
libs/base0% | 0% | 22% | 19% | 57%
libs/storage0% | 0% | 31% | 31% | 36%
libs/settings0% | 0% | 30% | 14% | 55%
libs/esp320% | 0% | 23% | 11% | 64%
libs/core0% | 0% | 7% | 14% | 78%
libs/radio0% | 0% | 21% | 0% | 78%
libs/net0% | 0% | 23% | 16% | 59%
scripts/font-compiler0% | 0% | 57% | 9% | 33%
scripts/raffs0% | 0% | 36% | 21% | 42%
libs/core---esp320% | 0% | 15% | 20% | 64%
libs/pulse0% | 0% | 23% | 7% | 69%
libs/mqtt0% | 0% | 19% | 8% | 71%
libs/lcd0% | 0% | 21% | 13% | 65%
libs/wifi---esp320% | 0% | 8% | 17% | 73%
libs/accelerometer0% | 0% | 13% | 29% | 56%
libs/color-coded-tilemap0% | 0% | 18% | 14% | 66%
libs/lora0% | 0% | 11% | 29% | 59%
cpptests0% | 0% | 38% | 30% | 30%
libs/serial---linux0% | 0% | 19% | 26% | 53%
libs/light0% | 0% | 5% | 18% | 76%
libs/datalogger0% | 0% | 31% | 0% | 68%
libs/azureiot0% | 0% | 7% | 4% | 87%
libs/text-to-speech0% | 0% | 23% | 28% | 48%
scripts/snorfs0% | 0% | 0% | 55% | 44%
libs/display0% | 0% | 0% | 43% | 56%
libs/net-game0% | 0% | 0% | 71% | 28%
libs/screen---ext0% | 0% | 0% | 60% | 39%
libs/light-spectrum-sensor0% | 0% | 0% | 47% | 52%
libs/controller0% | 0% | 0% | 21% | 78%
libs/music0% | 0% | 0% | 17% | 82%
cpptests/screen0% | 0% | 0% | 29% | 70%
libs/storyboard0% | 0% | 0% | 25% | 74%
libs/buttons0% | 0% | 0% | 26% | 73%
libs/core---linux0% | 0% | 0% | 7% | 92%
libs/matrix-keypad0% | 0% | 0% | 30% | 69%
libs/color-sensor0% | 0% | 0% | 34% | 65%
libs/gamepad0% | 0% | 0% | 27% | 72%
libs/sprite-scaling0% | 0% | 0% | 45% | 55%
libs/core---nrf520% | 0% | 0% | 47% | 52%
libs/rotary-encoder0% | 0% | 0% | 23% | 76%
libs/power0% | 0% | 0% | 37% | 62%
libs/serial0% | 0% | 0% | 0% | 100%
libs/color0% | 0% | 0% | 0% | 100%
libs/cable0% | 0% | 0% | 0% | 100%
libs/infrared0% | 0% | 0% | 0% | 100%
libs/keyboard0% | 0% | 0% | 0% | 100%
libs/touch0% | 0% | 0% | 0% | 100%
libs/settings---esp320% | 0% | 0% | 0% | 100%
libs/animation0% | 0% | 0% | 0% | 100%
libs/servo0% | 0% | 0% | 0% | 100%
libs/core---stm320% | 0% | 0% | 0% | 100%
libs/mouse0% | 0% | 0% | 0% | 100%
libs/proximity0% | 0% | 0% | 0% | 100%
libs/settings---files0% | 0% | 0% | 0% | 100%
libs/thermometer0% | 0% | 0% | 0% | 100%
libs/edge-connector0% | 0% | 0% | 0% | 100%
libs/lightsensor0% | 0% | 0% | 0% | 100%
libs/microphone0% | 0% | 0% | 0% | 100%
libs/game---light0% | 0% | 0% | 0% | 100%
libs/core---samd0% | 0% | 0% | 0% | 100%
libs/palette0% | 0% | 0% | 0% | 100%
libs/music---linux0% | 0% | 0% | 0% | 100%
libs/switch0% | 0% | 0% | 0% | 100%
libs/controller---none0% | 0% | 0% | 0% | 100%
libs/music---pwm0% | 0% | 0% | 0% | 100%
libs/pixel0% | 0% | 0% | 0% | 100%
libs/mixer---ext0% | 0% | 0% | 0% | 100%
libs/core---rp20400% | 0% | 0% | 0% | 100%
libs/radio-broadcast0% | 0% | 0% | 0% | 100%
libs/mixer---linux0% | 0% | 0% | 0% | 100%
scripts0% | 0% | 0% | 0% | 100%
libs/mixer---none0% | 0% | 0% | 0% | 100%
libs/mixer---nrf520% | 0% | 0% | 0% | 100%
libs/mixer---rp20400% | 0% | 0% | 0% | 100%
libs/mixer---samd0% | 0% | 0% | 0% | 100%
libs/mixer---stm320% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void validateFunction()
in libs/core---vm/vm.cpp
219 106 3
play()
in libs/mixer/melody.ts
212 68 1
bool drawImageCore()
in libs/screen/image.cpp
175 55 5
protected tilemapCollisions()
in libs/game/physics.ts
206 43 2
void JDDisplay::handleIncoming()
in libs/screen---st7735/jddisplay.cpp
77 33 1
void WDisplay::updateLoop()
in libs/screen---linux/screen.cpp
102 27 0
private instantaneousPosture()
in libs/accelerometer/sim/accelerometer.ts
49 24 0
move()
in libs/game/physics.ts
75 24 1
function shouldSkip()
in scripts/font-compiler/font-compiler.js
34 24 1
static void mainRunLoop()
in libs/core---vm/scheduler.cpp
69 23 0
private static generateNode()
in libs/game/animation.ts
112 23 5
private handleMessage()
in libs/mqtt/mqtt.ts
79 23 1
void fillRect()
in libs/screen/image.cpp
63 23 6
static int utf8canon()
in libs/base/core.cpp
56 22 3
drawPlayer()
in libs/game/info.ts
83 22 0
function internalRequest()
in libs/net/requests.ts
74 22 3
function loadPage()
in scripts/font-compiler/fromttf/fnt2txt.js
40 22 2
private static commandToArgCount()
in libs/game/animation.ts
36 21 1
void drawLine()
in libs/screen/image.cpp
71 21 6
export function drawLine()
in libs/screen/sim/image.ts
75 21 6