apple / swift-package-manager
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 1,054 units with 12,123 lines of code in units (21.3% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (193 lines of code)
    • 18 medium complex units (1,234 lines of code)
    • 65 simple units (2,276 lines of code)
    • 969 very simple units (8,420 lines of code)
0% | 1% | 10% | 18% | 69%
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
c0% | 14% | 30% | 22% | 32%
swift0% | <1% | 9% | 18% | 71%
py0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
mm0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/PackageCollectionsSigningLibc0% | 17% | 36% | 27% | 18%
Sources/Xcodeproj0% | 27% | 0% | 12% | 60%
Sources/PackageLoading0% | 0% | 39% | 17% | 42%
Sources/PackageCollections0% | 0% | 10% | 7% | 82%
Sources/PackageModel0% | 0% | 28% | 29% | 42%
Sources/PackagePlugin0% | 0% | 46% | 14% | 38%
Sources/SPMBuildCore0% | 0% | 24% | 11% | 63%
Sources/Commands0% | 0% | 3% | 23% | 72%
Sources/SPMTestSupport0% | 0% | 31% | 0% | 68%
Sources/Workspace0% | 0% | 5% | 17% | 76%
Sources/XCBuildSupport0% | 0% | 8% | 10% | 81%
Sources/Build0% | 0% | 5% | 22% | 71%
Sources/PackageCollectionsSigning0% | 0% | 0% | 35% | 64%
Sources/PackageGraph0% | 0% | 0% | 20% | 79%
Sources/SourceControl0% | 0% | 0% | 16% | 83%
Sources/PackageRegistry0% | 0% | 0% | 36% | 63%
Sources/swiftpm-xctest-helper0% | 0% | 0% | 87% | 12%
Sources/Basics0% | 0% | 0% | 24% | 75%
Fixtures/Miscellaneous0% | 0% | 0% | 0% | 100%
Fixtures/CFamilyTargets0% | 0% | 0% | 0% | 100%
Sources/PackageFingerprint0% | 0% | 0% | 0% | 100%
Sources/PackageDescription0% | 0% | 0% | 0% | 100%
Sources/SPMLLBuild0% | 0% | 0% | 0% | 100%
Sources/SPMPackageEditor0% | 0% | 0% | 0% | 100%
Sources/LLBuildManifest0% | 0% | 0% | 0% | 100%
Utilities0% | 0% | 0% | 0% | 100%
Fixtures/Resources0% | 0% | 0% | 0% | 100%
Fixtures/DependencyResolution0% | 0% | 0% | 0% | 100%
Sources/swiftpm-manifest-tool0% | 0% | 0% | 0% | 100%
Sources/tsan_utils0% | 0% | 0% | 0% | 100%
Fixtures/ModuleMaps0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func appendSetting()
in Sources/Xcodeproj/pbxproj.swift
94 37 4
static int asn1_d2i_read_bio()
in Sources/PackageCollectionsSigningLibc/asn1/a_d2i_fp.c
99 28 2
init()
in Sources/PackageModel/ManifestSourceGeneration.swift
75 22 1
func buildSettings()
in Sources/PackageLoading/PackageBuilder.swift
59 20 2
mutating func target()
in Sources/PackagePlugin/PluginInput.swift
111 20 1
int OCSP_basic_verify()
in Sources/PackageCollectionsSigningLibc/ocsp_vfy.c
55 19 2
func get()
in Sources/PackageCollections/Providers/GitHubPackageMetadataProvider.swift
111 17 4
func handle()
in Sources/Workspace/DefaultPluginScriptRunner.swift
66 16 1
func performTestsForPlugin()
in Sources/Commands/SwiftPackageTool.swift
86 15 2
static int ASN1_get_object_with_inf()
in Sources/PackageCollectionsSigningLibc/asn1/a_d2i_fp.c
55 15 5
func evaluateManifest()
in Sources/PackageLoading/ManifestLoader.swift
145 15 5
mutating func serialize()
in Sources/SPMBuildCore/PluginInvocation.swift
95 15 1
func create()
in Sources/SPMTestSupport/MockWorkspace.swift
81 15 3
func get()
in Sources/PackageCollections/Providers/JSONPackageCollectionProvider.swift
65 13 2
static int ASN1_get_object_without_inf()
in Sources/PackageCollectionsSigningLibc/asn1/a_d2i_fp.c
53 13 5
init()
in Sources/PackageModel/ManifestSourceGeneration.swift
36 13 1
static int ocsp_match_issuerid()
in Sources/PackageCollectionsSigningLibc/ocsp_vfy.c
41 12 3
func addStaticTargetInputs()
in Sources/Build/LLBuildManifestBuilder.swift
27 11 1
init()
in Sources/PackageModel/ManifestSourceGeneration.swift
43 11 2
func toPlatformFilters()
in Sources/XCBuildSupport/PIFBuilder.swift
30 11 0