apple / swift-nio-http2
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 354 units with 4,087 lines of code in units (25.5% of code).
    • 1 very long units (133 lines of code)
    • 8 long units (541 lines of code)
    • 36 medium size units (1,243 lines of code)
    • 66 small units (921 lines of code)
    • 243 very small units (1,249 lines of code)
3% | 13% | 30% | 22% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift3% | 13% | 31% | 21% | 30%
rb0% | 0% | 0% | 77% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/NIOHTTP28% | 22% | 19% | 17% | 32%
Sources/NIOHTTP2/ConnectionStateMachine0% | 13% | 48% | 20% | 17%
Sources/NIOHTTP2/Frame Buffers0% | 0% | 37% | 23% | 39%
Sources/NIOHPACK0% | 0% | 37% | 23% | 39%
Sources/NIOHTTP2PerformanceTester0% | 0% | 0% | 34% | 65%
scripts0% | 0% | 0% | 77% | 22%
Sources/NIOHTTP2Server0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
mutating func encode()
in Sources/NIOHTTP2/HTTP2FrameParser.swift
133 27 2
mutating func sendHeaders()
in Sources/NIOHTTP2/StreamStateMachine.swift
94 20 4
mutating func receiveHeaders()
in Sources/NIOHTTP2/StreamStateMachine.swift
94 20 4
init()
in Sources/NIOHTTP2/HTTP2ToHTTP1Codec.swift
72 34 1
mutating func sendSettings()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
61 13 1
mutating func receiveGoaway()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
57 10 1
mutating func sendGoaway()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
57 10 1
mutating func receiveData()
in Sources/NIOHTTP2/StreamStateMachine.swift
54 11 3
mutating func sendData()
in Sources/NIOHTTP2/StreamStateMachine.swift
52 11 3
mutating func receiveHeaders()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 3
mutating func sendHeaders()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 3
mutating func receiveData()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 4
mutating func sendData()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 4
mutating func receiveRstStream()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 2
mutating func sendRstStream()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
49 10 2
mutating func receivePushPromise()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
46 10 3
mutating func receiveWindowUpdate()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
46 10 2
mutating func sendWindowUpdate()
in Sources/NIOHTTP2/ConnectionStateMachine/ConnectionStateMachine.swift
46 10 2
mutating func processOutboundFrame()
in Sources/NIOHTTP2/Frame Buffers/OutboundFrameBuffer.swift
45 15 3
mutating func processInboundData()
in Sources/NIOHTTP2/HTTP2ToHTTP1Codec.swift
45 12 1