apple / swift-driver
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 427 units with 5,539 lines of code in units (24.7% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (364 lines of code)
    • 9 medium complex units (597 lines of code)
    • 25 simple units (793 lines of code)
    • 391 very simple units (3,785 lines of code)
0% | 6% | 10% | 14% | 68%
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% | 4% | 9% | 14% | 72%
cpp0% | 72% | 0% | 8% | 19%
py0% | 0% | 36% | 15% | 48%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/SwiftDriver0% | 4% | 9% | 14% | 71%
Sources/makeOptions0% | 72% | 0% | 8% | 19%
Utilities0% | 0% | 36% | 15% | 48%
Sources/swift-help0% | 0% | 0% | 45% | 55%
Sources/SwiftOptions0% | 0% | 0% | 18% | 81%
Sources/SwiftDriverExecution0% | 0% | 0% | 0% | 100%
Sources/swift-driver0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
mutating func addCommonFrontendOptions()
in Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
196 34 4
int makeOptions_main()
in Sources/makeOptions/makeOptions.cpp
168 30 0
mutating func addCompileInputs()
in Sources/SwiftDriver/Jobs/CompileJob.swift
91 20 6
mutating func compileJob()
in Sources/SwiftDriver/Jobs/CompileJob.swift
128 20 3
def handle_invocation()
in Utilities/build-script-helper.py
50 18 1
mutating func addFrontendSupplementaryOutputArguments()
in Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
98 16 6
def main()
in Utilities/build-script-helper.py
69 15 0
mutating func planPossiblyIncrementalBuild()
in Sources/SwiftDriver/Jobs/Planning.swift
38 14 0
func visit()
in Sources/SwiftDriver/ExplicitModuleBuilds/ClangVersionedDependencyResolution.swift
50 11 3
func lookup()
in Sources/SwiftDriver/Toolchains/Toolchain.swift
39 11 1
def get_swiftpm_options()
in Utilities/build-script-helper.py
34 11 1
static std::string swiftify()
in Sources/makeOptions/makeOptions.cpp
19 10 1
mutating func visit()
in Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift
80 9 1
mutating func visit()
in Sources/SwiftDriver/IncrementalCompilation/SourceFileDependencyGraph.swift
54 9 1
mutating func append()
in Sources/SwiftDriver/Jobs/CommandLineArguments.swift
27 9 1
mutating func computePrimaryOutput()
in Sources/SwiftDriver/Jobs/CompileJob.swift
27 9 3
func isTopLevelOutput()
in Sources/SwiftDriver/Jobs/CompileJob.swift
23 9 1
func dumpDotGraph()
in Sources/SwiftDriver/Jobs/PrebuiltModulesJob.swift
30 9 2
init?()
in Sources/SwiftDriver/Utilities/Triple.swift
11 9 1
func kindOrdering()
in Sources/SwiftDriver/IncrementalCompilation/DependencyKey.swift
11 8 1