apple / swift-metrics
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 31 units with 159 lines of code in units (23.0% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 1 medium size units (22 lines of code)
    • 1 small units (14 lines of code)
    • 29 very small units (123 lines of code)
0% | 0% | 13% | 8% | 77%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift0% | 0% | 13% | 8% | 77%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/CoreMetrics0% | 0% | 15% | 0% | 84%
Sources/Metrics0% | 0% | 0% | 82% | 17%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func increment()
in Sources/CoreMetrics/Metrics.swift
22 3 1
func record()
in Sources/Metrics/Metrics.swift
14 6 1
func makeCounter()
in Sources/CoreMetrics/Metrics.swift
10 1 3
func makeFloatingPointCounter()
in Sources/CoreMetrics/Metrics.swift
9 1 3
func makeRecorder()
in Sources/CoreMetrics/Metrics.swift
8 1 3
func makeTimer()
in Sources/CoreMetrics/Metrics.swift
7 1 3
func destroyCounter()
in Sources/CoreMetrics/Metrics.swift
6 1 1
func reset()
in Sources/CoreMetrics/Metrics.swift
6 1 0
func destroyFloatingPointCounter()
in Sources/CoreMetrics/Metrics.swift
5 1 1
func destroyRecorder()
in Sources/CoreMetrics/Metrics.swift
4 1 1
init()
in Sources/CoreMetrics/Metrics.swift
4 1 3
func increment()
in Sources/CoreMetrics/Metrics.swift
4 1 1
func increment()
in Sources/CoreMetrics/Metrics.swift
4 1 1
func record()
in Sources/CoreMetrics/Metrics.swift
4 1 1
func recordNanoseconds()
in Sources/CoreMetrics/Metrics.swift
4 1 1
func destroy()
in Sources/CoreMetrics/Metrics.swift
3 1 0
func destroy()
in Sources/CoreMetrics/Metrics.swift
3 1 0
func destroyTimer()
in Sources/CoreMetrics/Metrics.swift
3 1 1
func destroy()
in Sources/CoreMetrics/Metrics.swift
3 1 0
func reset()
in Sources/CoreMetrics/Metrics.swift
3 1 0