apple / swift-markdown
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 258 units with 2,086 lines of code in units (44.9% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (62 lines of code)
    • 1 medium complex units (30 lines of code)
    • 6 simple units (202 lines of code)
    • 250 very simple units (1,792 lines of code)
0% | 2% | 1% | 9% | 85%
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% | 1% | 9% | 85%
c0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/Markdown/Base0% | 24% | 0% | 0% | 75%
Sources/Markdown/Walker0% | 0% | 11% | 15% | 72%
Sources/Markdown/Parser0% | 0% | 0% | 30% | 69%
Sources/markdown-tool/Commands0% | 0% | 0% | 37% | 62%
Sources/Markdown/Visitor0% | 0% | 0% | 0% | 100%
Sources/Markdown/Block Nodes0% | 0% | 0% | 0% | 100%
Sources/Markdown/Inline Nodes0% | 0% | 0% | 0% | 100%
Sources/Markdown/Utility0% | 0% | 0% | 0% | 100%
Sources/Markdown/Structural Restrictions0% | 0% | 0% | 0% | 100%
Sources/CAtomic0% | 0% | 0% | 0% | 100%
Sources/Markdown/Infrastructure0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func makeMarkup()
in Sources/Markdown/Base/Markup.swift
62 30 1
func linePrefix()
in Sources/Markdown/Walker/Walkers/MarkupFormatter.swift
30 11 1
mutating func lex()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
43 10 1
mutating func softWrapPrint()
in Sources/Markdown/Walker/Walkers/MarkupFormatter.swift
40 10 2
mutating func accept()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
16 7 1
func run()
in Sources/markdown-tool/Commands/FormatCommand.swift
50 7 0
mutating func print()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
28 6 1
init()
in Sources/Markdown/Parser/CommonMarkConverter.swift
25 6 7
mutating func updateIndentation()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
12 5 2
func convertToRawMarkup()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
45 5 3
mutating func visitTable()
in Sources/Markdown/Walker/Walkers/MarkupTreeDumper.swift
15 5 1
func run()
in Sources/markdown-tool/Commands/DumpTreeCommand.swift
17 5 0
mutating func parseArgumentsText()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
15 4 1
func indentationAdjustment()
in Sources/Markdown/Parser/BlockDirectiveParser.swift
10 4 1
func parseCharacter()
in Sources/Markdown/Base/DirectiveArgument.swift
15 3 6
func hasSameStructure()
in Sources/Markdown/Base/RawMarkup.swift
15 3 1
init()
in Sources/Markdown/Inline Nodes/Inline Containers/Image.swift
15 3 3
func range()
in Sources/Markdown/Parser/CommonMarkConverter.swift
17 3 1
func firstAncestor()
in Sources/Markdown/Walker/Walkers/MarkupFormatter.swift
10 3 1
func numeralPrefix()
in Sources/Markdown/Walker/Walkers/MarkupFormatter.swift
13 3 1