apple / swift-collections
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 232 units with 1,603 lines of code in units (10.3% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 1 medium size units (43 lines of code)
    • 26 small units (338 lines of code)
    • 205 very small units (1,222 lines of code)
0% | 0% | 2% | 21% | 76%
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% | 2% | 21% | 76%
cpp0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/_CollectionsTestSupport0% | 0% | 3% | 20% | 76%
Benchmarks/Benchmarks0% | 0% | 0% | 32% | 67%
Sources/OrderedCollections0% | 0% | 0% | 24% | 75%
Sources/DequeModule0% | 0% | 0% | 0% | 100%
Sources/PriorityQueueModule0% | 0% | 0% | 0% | 100%
Benchmarks/CppBenchmarks0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func _description()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalEncoder.swift
43 22 2
func kalimbaOrdered3()
in Benchmarks/Benchmarks/Kalimba.swift
18 3 0
func replace()
in Sources/_CollectionsTestSupport/MinimalTypes/_CollectionState.swift
17 6 3
func isValidIndex()
in Sources/_CollectionsTestSupport/MinimalTypes/_CollectionState.swift
16 6 1
func kalimbaOrdered()
in Benchmarks/Benchmarks/Kalimba.swift
14 3 0
func kalimbaOrdered2()
in Benchmarks/Benchmarks/Kalimba.swift
14 3 0
func nestedContainer()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
14 2 2
func decodeNil()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
14 1 0
func nestedContainer()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
14 2 1
func insert()
in Sources/_CollectionsTestSupport/MinimalTypes/_CollectionState.swift
14 5 2
func remove()
in Sources/_CollectionsTestSupport/MinimalTypes/_CollectionState.swift
14 5 2
func swapBucketValues()
in Sources/OrderedCollections/OrderedSet/OrderedSet+Partial MutableCollection.swift
13 2 4
func _decodeNext()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
13 1 1
func assertValidIndexBeforeEnd()
in Sources/_CollectionsTestSupport/MinimalTypes/_MinimalCollectionCore.swift
13 1 2
func _failEarlyRangeCheck()
in Sources/_CollectionsTestSupport/MinimalTypes/_MinimalCollectionCore.swift
13 1 2
mutating func removeFirst()
in Sources/_CollectionsTestSupport/MinimalTypes/_MinimalCollectionCore.swift
13 1 1
func nestedUnkeyedContainer()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
12 2 0
func nestedContainer()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalEncoder.swift
12 1 1
func value()
in Sources/_CollectionsTestSupport/MinimalTypes/MinimalSequence.swift
12 5 1
init()
in Sources/OrderedCollections/HashTable/_Hashtable+Header.swift
11 3 3