apple / swift-nio-examples
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 103 units with 1,198 lines of code in units (33.0% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (146 lines of code)
    • 13 medium size units (413 lines of code)
    • 18 small units (273 lines of code)
    • 70 very small units (366 lines of code)
0% | 12% | 34% | 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
swift0% | 12% | 34% | 22% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
json-rpc/Sources0% | 20% | 14% | 29% | 34%
NIOSMTP/NIOSMTP0% | 23% | 38% | 21% | 16%
TLSify/Sources0% | 0% | 54% | 0% | 45%
backpressure-file-io-channel/Sources0% | 0% | 79% | 13% | 6%
UniversalBootstrapDemo/Sources0% | 0% | 70% | 30% | 0%
connect-proxy/Sources0% | 0% | 31% | 17% | 51%
http2-client/Sources0% | 0% | 16% | 36% | 46%
nio-launchd/Sources0% | 0% | 43% | 35% | 20%
http2-server/Sources0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func show()
in json-rpc/Sources/LightsdDemo/main.swift
78 23 1
func channelRead()
in NIOSMTP/NIOSMTP/SendEmailHandler.swift
68 21 2
func connected()
in TLSify/Sources/TLSifyLib/TLSProxy.swift
48 7 3
func runAction()
in backpressure-file-io-channel/Sources/BackpressureChannelToFileIO/SaveEverythingHTTPServer.swift
44 11 2
func configureBootstrap()
in NIOSMTP/NIOSMTP/ViewController.swift
39 8 4
func encode()
in NIOSMTP/NIOSMTP/SMTPRequestEncoder.swift
37 11 2
func run()
in TLSify/Sources/TLSify/main.swift
34 4 0
init()
in json-rpc/Sources/JsonRpc/Model.swift
34 7 1
func sendEmail()
in NIOSMTP/NIOSMTP/ViewController.swift
33 2 3
func run()
in UniversalBootstrapDemo/Sources/UniversalBootstrapDemo/main.swift
28 4 0
func channelRead()
in connect-proxy/Sources/ConnectProxy/ConnectHandler.swift
27 11 2
func requestFullyProcessed()
in backpressure-file-io-channel/Sources/BackpressureChannelToFileIO/SaveEverythingHTTPServer.swift
25 3 2
init()
in json-rpc/Sources/LightsdDemo/main.swift
22 9 1
func makeRequests()
in http2-client/Sources/http2-client/main.swift
21 2 4
func getServerFileDescriptorFromLaunchd()
in nio-launchd/Sources/nio-launchd/Server.swift
21 1 0
func channelRead()
in NIOSMTP/NIOSMTP/SMTPResponseDecoder.swift
20 4 2
func encode()
in json-rpc/Sources/JsonRpc/Model.swift
19 8 1
init()
in json-rpc/Sources/JsonRpc/Model.swift
18 8 1
init?()
in json-rpc/Sources/LightsdDemo/main.swift
18 4 1
func channelActive()
in http2-client/Sources/http2-client/main.swift
17 2 1