apple / swift-experimental-string-processing
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 710 units with 7,772 lines of code in units (35.1% of code).
    • 1 very complex units (156 lines of code)
    • 4 complex units (560 lines of code)
    • 21 medium complex units (1,072 lines of code)
    • 20 simple units (509 lines of code)
    • 664 very simple units (5,475 lines of code)
2% | 7% | 13% | 6% | 70%
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
swift2% | 7% | 13% | 6% | 70%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/_StringProcessing12% | 8% | 33% | 11% | 34%
Sources/_StringProcessing/Legacy0% | 35% | 24% | 9% | 30%
Sources/_MatchingEngine/Engine0% | 43% | 0% | 0% | 56%
Sources/Prototypes/PEG0% | 14% | 20% | 3% | 61%
Sources/_MatchingEngine/Regex0% | 0% | 27% | 19% | 53%
Sources/Exercises0% | 0% | 0% | 100% | 0%
Sources/_StringProcessing/RegexDSL0% | 0% | 0% | 0% | 100%
Sources/_StringProcessing/Algorithms0% | 0% | 0% | 0% | 100%
Sources/VariadicsGenerator0% | 0% | 0% | 0% | 100%
Sources/_MatchingEngine/Utility0% | 0% | 0% | 0% | 100%
Sources/Prototypes/TourOfTypes0% | 0% | 0% | 0% | 100%
Sources/PatternConverter0% | 0% | 0% | 0% | 100%
Sources/_Unicode0% | 0% | 0% | 0% | 100%
Sources/Prototypes/Combinators0% | 0% | 0% | 0% | 100%
Sources/Prototypes/PTCaRet0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func generateConsumer()
in Sources/_StringProcessing/ConsumerInterface.swift
156 70 1
mutating func cycle()
in Sources/_MatchingEngine/Engine/Processor.swift
175 41 0
func generateConsumer()
in Sources/_StringProcessing/ConsumerInterface.swift
102 39 1
func compileNode()
in Sources/_StringProcessing/Legacy/LegacyCompile.swift
210 39 1
func transpile()
in Sources/Prototypes/PEG/PEGTranspile.swift
73 27 0
func emit()
in Sources/_StringProcessing/Compiler.swift
76 25 1
mutating func cycle()
in Sources/Prototypes/PEG/PEGCore.swift
53 22 0
func execute()
in Sources/_StringProcessing/Legacy/HareVM.swift
99 22 3
func _consume()
in Sources/Prototypes/PEG/PEGInterpreter.swift
46 21 5
mutating func lexGroupStart()
in Sources/_MatchingEngine/Regex/Parse/LexicalAnalysis.swift
47 20 0
mutating func lexMatchingOption()
in Sources/_MatchingEngine/Regex/Parse/LexicalAnalysis.swift
41 19 0
mutating func lexExplicitPCRE2GroupStart()
in Sources/_MatchingEngine/Regex/Parse/LexicalAnalysis.swift
40 18 0
mutating func lexAtom()
in Sources/_MatchingEngine/Regex/Parse/LexicalAnalysis.swift
31 18 1
mutating func printAsPattern()
in Sources/_MatchingEngine/Regex/Printing/PrintAsPattern.swift
60 18 1
func generateConsumer()
in Sources/_StringProcessing/ConsumerInterface.swift
69 18 1
init?()
in Sources/_StringProcessing/MatchingOptions.swift
40 18 1
func emitAssertion()
in Sources/_StringProcessing/Compiler.swift
47 16 1
mutating func outputAsCanonical()
in Sources/_MatchingEngine/Regex/Printing/PrintAsCanonical.swift
42 15 1
func compileQuantification()
in Sources/_StringProcessing/Compiler.swift
113 15 4
func generateConsumer()
in Sources/_StringProcessing/ConsumerInterface.swift
36 15 1