apple / swift-argument-parser
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 196 units with 1,862 lines of code in units (32.1% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 4 medium complex units (282 lines of code)
    • 13 simple units (322 lines of code)
    • 179 very simple units (1,258 lines of code)
0% | 0% | 15% | 17% | 67%
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% | 15% | 17% | 67%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/ArgumentParser/Parsing0% | 0% | 15% | 18% | 65%
Sources/ArgumentParser/Usage0% | 0% | 22% | 16% | 60%
Sources/ArgumentParser/Utilities0% | 0% | 0% | 33% | 66%
Sources/ArgumentParser/Completions0% | 0% | 0% | 22% | 77%
Sources/ArgumentParser/Parsable Types0% | 0% | 0% | 0% | 100%
Tools/changelog-authors0% | 0% | 0% | 0% | 100%
Sources/ArgumentParser/Parsable Properties0% | 0% | 0% | 0% | 100%
Sources/ArgumentParserTestHelpers0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
init()
in Sources/ArgumentParser/Usage/MessageInfo.swift
91 24 2
func makeErrorMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
50 21 0
func parseValue()
in Sources/ArgumentParser/Parsing/ArgumentSet.swift
97 20 6
func lenientParse()
in Sources/ArgumentParser/Parsing/ArgumentSet.swift
44 11 1
mutating func parse()
in Sources/ArgumentParser/Parsing/CommandParser.swift
34 10 1
func parseIndividualArg()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
42 10 2
func zshActionString()
in Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift
20 8 1
func handleCustomCompletion()
in Sources/ArgumentParser/Parsing/CommandParser.swift
35 8 1
mutating func remove()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
23 8 1
func coalescedExtraElements()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
29 8 0
func editDistance()
in Sources/ArgumentParser/Utilities/StringExtensions.swift
27 8 1
func fullText()
in Sources/ArgumentParser/Usage/MessageInfo.swift
12 7 1
func unknownOptionMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
24 7 2
func unableToParseValueMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
24 7 5
func addingPrefixWithAutodetectedStyle()
in Sources/ArgumentParser/Utilities/StringExtensions.swift
11 7 1
init?()
in Sources/ArgumentParser/Usage/DumpHelpGenerator.swift
15 6 1
init()
in Sources/ArgumentParser/Usage/HelpGenerator.swift
26 6 1
func zshCompletionString()
in Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift
27 5 1
func makeNames()
in Sources/ArgumentParser/Parsable Properties/NameSpecification.swift
15 5 2
init()
in Sources/ArgumentParser/Parsable Types/ParsableArguments.swift
34 5 2