microsoft / pxt
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 7,793 units with 109,261 lines of code in units (72.5% of code).
    • 20 very complex units (4,060 lines of code)
    • 97 complex units (9,765 lines of code)
    • 427 medium complex units (20,007 lines of code)
    • 851 simple units (21,643 lines of code)
    • 6,398 very simple units (53,786 lines of code)
3% | 8% | 18% | 19% | 49%
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
ts3% | 8% | 18% | 20% | 48%
tsx3% | 8% | 18% | 18% | 51%
js0% | 14% | 12% | 17% | 54%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
cli10% | 7% | 21% | 17% | 43%
pxtcompiler6% | 15% | 23% | 19% | 35%
webapp2% | 10% | 15% | 18% | 52%
pxtlib3% | 6% | 15% | 22% | 52%
pxtblocks3% | 5% | 16% | 23% | 51%
pxteditor24% | 0% | 0% | 16% | 59%
pxtpy0% | 10% | 26% | 20% | 42%
pxtsim0% | 4% | 18% | 15% | 60%
skillmap0% | 3% | 22% | 26% | 47%
pxtrunner0% | 0% | 31% | 20% | 48%
libs0% | 0% | 17% | 16% | 65%
docfiles0% | 0% | 16% | 20% | 63%
react-common0% | 0% | 48% | 0% | 51%
pxtwinrt0% | 0% | 8% | 14% | 77%
pxt-cli0% | 0% | 36% | 35% | 27%
ROOT0% | 0% | 0% | 14% | 85%
scripts0% | 0% | 0% | 16% | 83%
pxtwapp0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
renderCore()
in webapp/src/app.tsx
152 119 0
function getCallStatement()
in pxtcompiler/emitter/decompiler.ts
276 93 2
renderCore()
in webapp/src/share.tsx
215 84 0
private handleDirective()
in pxtlib/emitter/assembler.ts
177 80 1
header: lf()
in webapp/src/app.tsx
324 80 1
364 71 1
270 63 1
export function bindEditorMessages()
in pxteditor/editorcontroller.ts
229 63 1
function infer()
in pxtblocks/blocklycompiler.ts
149 61 3
resolve()
in pxtcompiler/emitter/ir.ts
177 60 0
export function getCompletions()
in pxtcompiler/emitter/languageservice.ts
237 60 1
150 60 1
function buildBlockFromDef()
in pxtblocks/blocklyloader.ts
169 59 2
export function prepTemplate()
in pxtlib/docsrender.ts
223 58 1
export function internalGetApiInfo()
in pxtcompiler/emitter/service.ts
150 56 3
260 54 1
function createSymbolInfo()
in pxtcompiler/emitter/service.ts
135 53 3
renderCore()
in webapp/src/editortoolbar.tsx
96 52 0
247 51 1
renderCore()
in webapp/src/container.tsx
60 51 0