apple / swift-http-structured-headers
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 203 units with 1,360 lines of code in units (45.6% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (93 lines of code)
    • 5 medium complex units (239 lines of code)
    • 4 simple units (82 lines of code)
    • 193 very simple units (946 lines of code)
0% | 6% | 17% | 6% | 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
swift0% | 6% | 17% | 6% | 69%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/StructuredFieldValues/Encoder0% | 15% | 23% | 3% | 57%
Sources/StructuredFieldValues/Decoder0% | 0% | 16% | 2% | 80%
Sources/sh-parser0% | 0% | 0% | 37% | 62%
Sources/RawStructuredFieldValues0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func encode()
in Sources/StructuredFieldValues/Encoder/StructuredFieldValueEncoder.swift
93 29 2
func append()
in Sources/StructuredFieldValues/Encoder/StructuredFieldValueEncoder.swift
52 21 1
func innerElement()
in Sources/StructuredFieldValues/Decoder/StructuredFieldValueDecoder.swift
65 19 1
func decode()
in Sources/StructuredFieldValues/Decoder/BareItemDecoder.swift
38 17 1
func encode()
in Sources/StructuredFieldValues/Encoder/StructuredFieldValueEncoder.swift
38 17 1
mutating func insert()
in Sources/StructuredFieldValues/Encoder/StructuredFieldValueEncoder.swift
46 16 2
func prettyFormat()
in Sources/sh-parser/main.swift
18 8 0
func container()
in Sources/StructuredFieldValues/Decoder/StructuredFieldValueDecoder.swift
16 7 1
mutating func appendBareItem()
in Sources/StructuredFieldValues/Encoder/StructuredFieldValueEncoder.swift
20 7 1
func main()
in Sources/sh-parser/main.swift
28 7 0
func unkeyedContainer()
in Sources/StructuredFieldValues/Decoder/StructuredFieldValueDecoder.swift
12 5 0
init()
in Sources/sh-parser/main.swift
15 5 0
func validateStructuredHeaderKey()
in Sources/RawStructuredFieldValues/FieldSerializer.swift
23 4 0
func singleValueContainer()
in Sources/StructuredFieldValues/Decoder/StructuredFieldValueDecoder.swift
10 4 0
func prettyPrint()
in Sources/sh-parser/main.swift
13 4 0
mutating func decode()
in Sources/StructuredFieldValues/Decoder/BareInnerListDecoder.swift
22 3 1
func decode()
in Sources/StructuredFieldValues/Decoder/BareItemDecoder.swift
10 3 1
func decode()
in Sources/StructuredFieldValues/Decoder/BareItemDecoder.swift
8 3 1
func decode()
in Sources/StructuredFieldValues/Decoder/DictionaryKeyedContainer.swift
15 3 2
func decode()
in Sources/StructuredFieldValues/Decoder/KeyedInnerListDecoder.swift
15 3 2