apple / swift-protobuf
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 6,604 units with 65,619 lines of code in units (34.5% of code).
    • 33 very complex units (14,559 lines of code)
    • 16 complex units (1,118 lines of code)
    • 98 medium complex units (3,844 lines of code)
    • 107 simple units (2,202 lines of code)
    • 6,350 very simple units (43,896 lines of code)
22% | 1% | 5% | 3% | 66%
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
swift22% | 1% | 5% | 3% | 66%
js0% | 0% | 39% | 0% | 60%
h0% | 0% | 0% | 81% | 18%
py0% | 0% | 0% | 58% | 41%
cc0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Reference21% | <1% | 1% | <1% | 76%
Reference/google38% | 4% | 13% | 6% | 38%
Sources/Conformance0% | 18% | 59% | 5% | 17%
Reference/conformance0% | 28% | 49% | 8% | 13%
Sources/protoc-gen-swift0% | 0% | 28% | 28% | 42%
Sources/SwiftProtobuf0% | 0% | 1% | 5% | 93%
Performance/js0% | 0% | 39% | 0% | 60%
Performance0% | 0% | 31% | 27% | 40%
Sources/SwiftProtobufPluginLibrary0% | 0% | 12% | 18% | 68%
DevTools0% | 0% | 0% | 58% | 41%
FuzzTesting/Sources0% | 0% | 0% | 0% | 100%
Reference/SwiftProtobufPluginLibrary0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
mutating func decodeMessage()
in Reference/google/protobuf/unittest_enormous_descriptor.pb.swift
1010 1002 1
func traverse()
in Reference/google/protobuf/unittest_enormous_descriptor.pb.swift
3005 1001 1
init?()
in Reference/generated_swift_names_enum_cases.pb.swift
875 871 1
mutating func decodeMessage()
in Reference/generated_swift_names_fields.pb.swift
879 871 1
func traverse()
in Reference/generated_swift_names_fields.pb.swift
2612 870 1
mutating func decodeMessage()
in Reference/fuzz_testing.pb.swift
423 320 1
func traverse()
in Reference/fuzz_testing.pb.swift
852 295 1
mutating func decodeMessage()
in Reference/unittest_swift_naming.pb.swift
232 224 1
func traverse()
in Reference/unittest_swift_naming.pb.swift
671 224 1
init?()
in Reference/unittest_swift_naming.pb.swift
213 210 1
mutating func decodeMessage()
in Reference/unittest_swift_runtime_proto2.pb.swift
219 117 1
mutating func decodeMessage()
in Reference/google/protobuf/unittest_well_known_types.pb.swift
241 110 1
mutating func decodeMessage()
in Reference/unittest_swift_runtime_proto3.pb.swift
204 109 1
init?()
in Reference/google/protobuf/unittest.pb.swift
106 102 1
mutating func decodeMessage()
in Reference/google/protobuf/unittest_lite.pb.swift
145 101 1
func traverse()
in Reference/unittest_swift_runtime_proto2.pb.swift
245 93 1
func traverse()
in Reference/unittest_swift_runtime_proto3.pb.swift
235 89 1
mutating func decodeMessage()
in Reference/google/protobuf/unittest.pb.swift
118 88 1
func traverse()
in Reference/google/protobuf/unittest_lite.pb.swift
247 85 1
func traverse()
in Reference/google/protobuf/unittest.pb.swift
237 81 1