microsoft / pxt-brainpad
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 705 units with 6,311 lines of code in units (54.8% of code).
    • 1 very complex units (175 lines of code)
    • 1 complex units (82 lines of code)
    • 18 medium complex units (910 lines of code)
    • 43 simple units (1,107 lines of code)
    • 642 very simple units (4,037 lines of code)
2% | 1% | 14% | 17% | 63%
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
cpp8% | 0% | 19% | 14% | 56%
ts0% | 1% | 12% | 18% | 66%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
libs/screen19% | 0% | 24% | 9% | 47%
libs/game0% | 5% | 24% | 16% | 54%
libs/core0% | 0% | 9% | 10% | 79%
libs/infrared0% | 0% | 47% | 0% | 52%
sim/visuals0% | 0% | 13% | 33% | 53%
libs/accelerometer0% | 0% | 17% | 18% | 63%
libs/display0% | 0% | 0% | 53% | 46%
libs/neopixel0% | 0% | 0% | 36% | 63%
libs/leds0% | 0% | 0% | 100% | 0%
libs/music0% | 0% | 0% | 16% | 83%
libs/base0% | 0% | 0% | 50% | 50%
libs/controller0% | 0% | 0% | 28% | 71%
sim0% | 0% | 0% | 17% | 82%
libs/brainbot0% | 0% | 0% | 7% | 92%
sim/state0% | 0% | 0% | 0% | 100%
libs/lightbulb0% | 0% | 0% | 0% | 100%
libs/settings0% | 0% | 0% | 0% | 100%
libs/animation0% | 0% | 0% | 0% | 100%
libs/braingamer0% | 0% | 0% | 0% | 100%
libs/cptest0% | 0% | 0% | 0% | 100%
libs/sonar0% | 0% | 0% | 0% | 100%
libs/led0% | 0% | 0% | 0% | 100%
libs/buttons0% | 0% | 0% | 0% | 100%
libs/thermometer0% | 0% | 0% | 0% | 100%
editor0% | 0% | 0% | 0% | 100%
libs/brainpad0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
bool drawImageCore()
in libs/screen/image.cpp
175 55 5
public moveSprite()
in libs/game/physics.ts
82 30 4
private instantaneousPosture()
in libs/accelerometer/sim/accelerometer.ts
49 24 0
void fillRect()
in libs/screen/image.cpp
63 23 6
say()
in libs/game/sprite.ts
107 22 4
void drawLine()
in libs/screen/image.cpp
71 21 6
setImage()
in libs/game/sprite.ts
48 19 1
function initHUD()
in libs/game/info.ts
48 18 0
void ReceiverIR::isr_changed()
in libs/infrared/receiverir.cpp
73 16 1
int HF2::endpointRequest()
in libs/core/hf2.cpp
76 15 0
43 14 1
render()
in libs/game/background.ts
38 13 2
export function controlSprite()
in libs/game/controller.ts
36 13 3
public update()
in libs/core/sim/neopixel.ts
46 12 1
collisions()
in libs/game/physics.ts
33 12 0
void mapRect()
in libs/screen/image.cpp
33 12 6
private updateLightLevel()
in sim/visuals/board.ts
58 12 0
__update()
in libs/game/sprite.ts
31 11 2
void replace()
in libs/screen/image.cpp
25 11 3
void blitRow()
in libs/screen/image.cpp
32 11 6