apple / swift-metrics-extras
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 8 units with 87 lines of code in units (24.9% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 2 medium size units (57 lines of code)
    • 0 small units (0 lines of code)
    • 6 very small units (30 lines of code)
0% | 0% | 65% | 0% | 34%
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% | 65% | 0% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/SystemMetrics0% | 0% | 65% | 0% | 34%
Alternative Visuals
Longest Units
Top 8 longest units
Unit# linesMcCabe index# params
func readLine()
in Sources/SystemMetrics/SystemMetrics.swift
36 5 0
init()
in Sources/SystemMetrics/SystemMetrics.swift
21 2 1
func close()
in Sources/SystemMetrics/SystemMetrics.swift
7 2 0
func loop()
in Sources/SystemMetrics/SystemMetrics.swift
7 2 0
func open()
in Sources/SystemMetrics/SystemMetrics.swift
6 1 0
func readFull()
in Sources/SystemMetrics/SystemMetrics.swift
4 1 0
func label()
in Sources/SystemMetrics/SystemMetrics.swift
3 1 1
init()
in Sources/SystemMetrics/SystemMetrics.swift
3 1 1