apple / swift-tools-support-core
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 217 units with 1,944 lines of code in units (15.3% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 4 medium complex units (183 lines of code)
    • 13 simple units (327 lines of code)
    • 200 very simple units (1,434 lines of code)
0% | 0% | 9% | 16% | 73%
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% | 0% | 10% | 17% | 72%
py0% | 0% | 0% | 14% | 85%
c0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/TSCUtility0% | 0% | 16% | 13% | 69%
Sources/TSCBasic0% | 0% | 5% | 18% | 75%
Utilities0% | 0% | 0% | 14% | 85%
Sources/TSCTestSupport0% | 0% | 0% | 58% | 41%
Sources/TSCclibc0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
init()
in Sources/TSCBasic/Path.swift
52 14 1
mutating func readBlockInfoBlock()
in Sources/TSCUtility/BitstreamReader.swift
50 14 1
mutating func withAbbreviatedRecord()
in Sources/TSCUtility/BitstreamReader.swift
53 12 2
mutating func readSingleAbbreviatedRecordOperand()
in Sources/TSCUtility/BitstreamReader.swift
28 11 1
init()
in Sources/TSCBasic/Path.swift
49 10 1
mutating func readBlock()
in Sources/TSCUtility/BitstreamReader.swift
52 10 4
mutating func readAbbrevOp()
in Sources/TSCUtility/BitstreamReader.swift
24 9 0
func match()
in Sources/TSCTestSupport/AssertMatch.swift
17 8 2
func readFileContents()
in Sources/TSCBasic/FileSystem.swift
25 7 1
func getNodeInternal()
in Sources/TSCBasic/FileSystem.swift
21 7 1
func suffix()
in Sources/TSCBasic/Path.swift
25 7 1
init()
in Sources/TSCBasic/TemporaryFile.swift
20 7 1
def build_with_cmake()
in Utilities/build-script-helper.py
21 7 4
func writeFileContents()
in Sources/TSCBasic/FileSystem.swift
19 6 2
func spm_localizedJoin()
in Sources/TSCBasic/StringConversions.swift
19 6 1
func parse()
in Sources/TSCUtility/ArgumentParser.swift
20 6 2
mutating func readAbbrev()
in Sources/TSCUtility/BitstreamReader.swift
15 6 1
func split()
in Sources/TSCBasic/DeltaAlgorithm.swift
20 5 1
func search()
in Sources/TSCBasic/DeltaAlgorithm.swift
26 5 3
init()
in Sources/TSCBasic/FileSystem.swift
14 5 2