microsoft / pyright
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 34,691 units with 113,550 lines of code in units (62.6% of code).
    • 41 very complex units (10,893 lines of code)
    • 81 complex units (9,220 lines of code)
    • 293 medium complex units (17,029 lines of code)
    • 378 simple units (11,527 lines of code)
    • 33,898 very simple units (64,881 lines of code)
9% | 8% | 14% | 10% | 57%
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
ts16% | 13% | 25% | 17% | 26%
pyi0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
packages/pyright-internal/src/analyzer20% | 15% | 28% | 15% | 19%
packages/pyright-internal/src/parser7% | 13% | 22% | 17% | 38%
packages/pyright-internal/src9% | 5% | 14% | 14% | 57%
packages/pyright-internal/src/languageService3% | 11% | 24% | 30% | 29%
packages/pyright-internal/src/common0% | 0% | 7% | 17% | 74%
packages/pyright-internal/src/localization0% | 0% | 31% | 19% | 49%
packages/vscode-pyright/src0% | 0% | 0% | 73% | 26%
packages/pyright-internal/src/commands0% | 0% | 0% | 42% | 57%
packages/pyright-internal/typeshed-fallback/stubs0% | 0% | 0% | 0% | 100%
packages/pyright-internal/typeshed-fallback/stdlib0% | 0% | 0% | 0% | 100%
build/lib0% | 0% | 0% | 0% | 100%
build0% | 0% | 0% | 0% | 100%
packages/vscode-pyright/build0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
export function getTypeNarrowingCallback()
in packages/pyright-internal/src/analyzer/typeGuards.ts
428 132 4
function getTypeOfClass()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
408 116 1
function canAssignFunction()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
461 110 6
leftType: printType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
491 109 1
function getTypeFromFlowNode()
in packages/pyright-internal/src/analyzer/codeFlowEngine.ts
511 103 5
function narrowTypeForIsInstance()
in packages/pyright-internal/src/analyzer/typeGuards.ts
291 94 3
function matchFunctionArgumentsToParameters()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
361 92 4
function getTypeOfFunction()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
286 92 1
export function getUnescapedString()
in packages/pyright-internal/src/parser/stringTokenUtils.ts
358 90 1
type: printType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
281 88 1
export function printType()
in packages/pyright-internal/src/analyzer/typePrinter.ts
325 87 4
export function isTypeSame()
in packages/pyright-internal/src/analyzer/types.ts
275 85 5
export function synthesizeDataClassMethods()
in packages/pyright-internal/src/analyzer/dataClasses.ts
360 84 5
function applyDescriptorAccessMethod()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
256 82 10
sourceType: printType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
296 80 1
export function printParseNodeType()
in packages/pyright-internal/src/analyzer/parseTreeUtils.ts
157 77 1
function createSpecializedClassType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
260 77 4
function getTypeOfExpression()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
318 73 3
function getTypeFromMemberAccessWithBaseType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
269 73 4
sourceType: printType()
in packages/pyright-internal/src/analyzer/typeEvaluator.ts
257 72 1