apple / swift-corelibs-foundation
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 5,715 units with 88,775 lines of code in units (40.8% of code).
    • 39 very complex units (8,698 lines of code)
    • 115 complex units (10,352 lines of code)
    • 422 medium complex units (20,232 lines of code)
    • 582 simple units (14,177 lines of code)
    • 4,557 very simple units (35,316 lines of code)
9% | 11% | 22% | 15% | 39%
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
c12% | 14% | 27% | 17% | 27%
swift1% | <1% | 5% | 11% | 80%
py0% | 22% | 2% | 18% | 55%
h0% | 0% | 3% | 5% | 91%
m0% | 0% | 49% | 19% | 30%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
CoreFoundation/String.subproj29% | 13% | 22% | 14% | 20%
CoreFoundation/Locale.subproj22% | 15% | 31% | 11% | 19%
CoreFoundation/Parsing.subproj16% | 16% | 28% | 15% | 22%
CoreFoundation/PlugIn.subproj10% | 19% | 32% | 14% | 23%
CoreFoundation/StringEncodings.subproj14% | 16% | 32% | 16% | 19%
CoreFoundation/RunLoop.subproj4% | 10% | 31% | 19% | 34%
Sources/Foundation3% | 1% | 7% | 11% | 75%
CoreFoundation/Base.subproj2% | 6% | 24% | 19% | 46%
CoreFoundation/URL.subproj0% | 23% | 32% | 16% | 27%
CoreFoundation/NumberDate.subproj0% | 27% | 14% | 15% | 43%
CoreFoundation/Collections.subproj0% | 7% | 15% | 27% | 49%
lib0% | 22% | 2% | 18% | 55%
CoreFoundation/Preferences.subproj0% | 6% | 28% | 25% | 39%
Darwin/Foundation-swiftoverlay0% | 3% | 12% | 17% | 66%
CoreFoundation/Stream.subproj0% | 0% | 27% | 34% | 37%
Sources/FoundationNetworking0% | 0% | 8% | 19% | 72%
CoreFoundation/AppServices.subproj0% | 0% | 58% | 14% | 26%
CoreFoundation/Error.subproj0% | 0% | 36% | 4% | 58%
Sources/Tools0% | 0% | 28% | 58% | 13%
Darwin/Foundation-swiftoverlay-Tests0% | 0% | <1% | 4% | 94%
Sources/BlocksRuntime0% | 0% | 0% | 38% | 61%
Darwin/shims0% | 0% | 0% | 10% | 89%
bootstrap/x86_64-apple-darwin0% | 0% | 0% | 2% | 97%
Sources/FoundationXML0% | 0% | 0% | 0% | 100%
Sources/UUID0% | 0% | 0% | 0% | 100%
DarwinCompatibilityTests0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
static Boolean _CFBundleGrokFileType()
in CoreFoundation/PlugIn.subproj/CFBundle_Grok.c
230 338 9
CF_PRIVATE bool __CFBinaryPlistCreateObjectFiltered()
in CoreFoundation/Parsing.subproj/CFBinaryPList.c
553 240 12
static Boolean __CFStringAppendFormatCore()
in CoreFoundation/String.subproj/CFString.c
633 235 2
Boolean CFStringFindWithOptionsAndLocale()
in CoreFoundation/String.subproj/CFString.c
382 226 6
CFComparisonResult CFStringCompareWithOptionsAndLocale()
in CoreFoundation/String.subproj/CFString.c
304 211 5
static CFIndex __CFCalendarGetOrdinalityOfUnit3()
in CoreFoundation/Locale.subproj/CFCalendar.c
703 165 4
Boolean __CFStringDecodeByteStream3()
in CoreFoundation/String.subproj/CFStringEncodings.c
327 153 7
static Boolean __CFCharacterSetEqual()
in CoreFoundation/String.subproj/CFCharacterSet.c
252 147 2
CFIndex __CFStringEncodeByteStream()
in CoreFoundation/String.subproj/CFStringEncodings.c
270 119 9
CFTypeRef CFNumberFormatterCopyProperty()
in CoreFoundation/Locale.subproj/CFNumberFormatter.c
220 116 2
func read()
in Sources/Foundation/NSURL.swift
197 111 2
Boolean CFCalendarGetTimeRangeOfUnit()
in CoreFoundation/Locale.subproj/CFCalendar.c
245 110 5
CF_INLINE Boolean __CFParseFormatSpec()
in CoreFoundation/String.subproj/CFString.c
220 107 7
void CFStringNormalize()
in CoreFoundation/String.subproj/CFString.c
263 92 2
static Boolean _CFBundleGetPackageInfoInDirectoryWithInfoDictionary()
in CoreFoundation/PlugIn.subproj/CFBundle_InfoPlist.c
90 90 5
static CFRange __CFCalendarGetRangeOfUnit3()
in CoreFoundation/Locale.subproj/CFCalendar.c
202 86 4
static Boolean parseXMLElement()
in CoreFoundation/Parsing.subproj/CFPropertyList.c
204 86 4
static CFIndex __CFStringFoldCharacterClusterAtIndex()
in CoreFoundation/String.subproj/CFString.c
180 85 9
void CFCharacterSetIntersect()
in CoreFoundation/String.subproj/CFCharacterSet.c
218 82 2
uint32_t CFStringEncodingUnicodeToBytes()
in CoreFoundation/StringEncodings.subproj/CFStringEncodingConverter.c
163 81 8