microsoft / pxt-microbit
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 844 units with 8,595 lines of code in units (68.1% of code).
    • 0 very complex units (0 lines of code)
    • 14 complex units (583 lines of code)
    • 33 medium complex units (1,324 lines of code)
    • 56 simple units (1,580 lines of code)
    • 741 very simple units (5,108 lines of code)
0% | 6% | 15% | 18% | 59%
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
ts0% | 7% | 16% | 16% | 59%
js0% | 10% | 19% | 29% | 40%
cpp0% | 0% | 5% | 8% | 85%
cs0% | 0% | 12% | 5% | 82%
tsx0% | 0% | 0% | 0% | 100%
h0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
libs0% | 12% | 5% | 14% | 67%
editor0% | 7% | 20% | 27% | 44%
sim0% | 0% | 20% | 14% | 64%
clients0% | 0% | 12% | 4% | 82%
compiler0% | 0% | 56% | 0% | 43%
pxtwapp0% | 0% | 0% | 0% | 100%
fieldeditors0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
export function iconImage()
in libs/core/icons.ts
251 41 1
public ifOnEdgeBounce()
in libs/core/game.ts
44 33 0
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function step()
in editor/prepend/dapjs.js
22 30 1
function playNextNote()
in libs/core/music.ts
46 30 1
private instantaneousPosture()
in sim/state/accelerometer.ts
49 24 0
89 21 2
export function getMelody()
in libs/core/melodies.ts
46 21 1
47 20 3
private updatePin()
in sim/visuals/microbit.ts
30 20 2
void handleFile()
in clients/winuploader/Microbit.Uploader/MainForm.cs
59 18 1