apple / swift-docc
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 643 units with 6,460 lines of code in units (23.1% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (152 lines of code)
    • 10 medium complex units (382 lines of code)
    • 27 simple units (845 lines of code)
    • 604 very simple units (5,081 lines of code)
0% | 2% | 5% | 13% | 78%
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
swift0% | 2% | 5% | 13% | 79%
py0% | 0% | 31% | 9% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/SwiftDocC/Model0% | 7% | 6% | 12% | 73%
Sources/SwiftDocC/Indexing0% | 14% | 11% | 18% | 55%
Sources/SwiftDocC/Infrastructure0% | 0% | 7% | 25% | 67%
ROOT0% | 0% | 31% | 9% | 58%
Sources/SwiftDocC/Semantics0% | 0% | 3% | 5% | 90%
Sources/SwiftDocC/Utility0% | 0% | 6% | 4% | 89%
Sources/SwiftDocCUtilities/PreviewServer0% | 0% | 0% | 49% | 50%
Sources/SwiftDocCUtilities/Action0% | 0% | 0% | 11% | 88%
Sources/SwiftDocCUtilities/Utility0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/LinkTargets0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/DocumentationService0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Checker0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Converter0% | 0% | 0% | 0% | 100%
Sources/SwiftDocCUtilities/ArgumentParsing0% | 0% | 0% | 0% | 100%
Sources/SwiftDocCTestUtilities0% | 0% | 0% | 0% | 100%
Sources/SwiftDocCUtilities/Transformers0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Benchmark0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Servers0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
init()
in Sources/SwiftDocC/Model/DocumentationMarkup.swift
118 32 2
init()
in Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift
34 30 1
mutating func visitBlockDirective()
in Sources/SwiftDocC/Semantics/SemanticAnalyzer.swift
57 25 1
init()
in Sources/SwiftDocC/Utility/LMDB/LMDB+Error.swift
30 25 1
init()
in Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift
27 24 1
init()
in Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift
27 23 1
func role()
in Sources/SwiftDocC/Model/Rendering/DocumentationContentRenderer.swift
19 15 1
def run()
in build-script-helper.py
66 13 1
mutating func referenceFromLink()
in Sources/SwiftDocC/Infrastructure/DocumentationCurator.swift
47 11 3
mutating func loadAll()
in Sources/SwiftDocC/Infrastructure/Symbol Graph/SymbolGraphLoader.swift
53 11 0
func title()
in Sources/SwiftDocC/Model/Rendering/LinkTitleResolver.swift
30 11 1
init()
in Sources/SwiftDocC/Model/Rendering/RenderNode/CodableRenderReference.swift
26 11 1
init()
in Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift
14 10 1
func buildRelationships()
in Sources/SwiftDocC/Infrastructure/DocumentationContext.swift
20 10 3
func separatedForTermDefinition()
in Sources/SwiftDocC/Model/Rendering/Content/Extensions/RenderTermLists.swift
41 10 1
init()
in Sources/SwiftDocC/Model/Rendering/RenderNode/CodableRenderSection.swift
25 10 1
mutating func visitDocument()
in Sources/SwiftDocC/Semantics/SemanticAnalyzer.swift
52 10 1
func topLevelIndexingRecord()
in Sources/SwiftDocC/Indexing/RenderNode+Indexable.swift
28 9 0
func referencesForSymbols()
in Sources/SwiftDocC/Infrastructure/DocumentationContext.swift
37 9 2
func mergeDeclaration()
in Sources/SwiftDocC/Semantics/Symbol/Symbol.swift
43 9 4