apple / swift-xcode-playground-support
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 494 units with 4,490 lines of code in units (57.5% of code).
    • 3 very long units (354 lines of code)
    • 4 long units (253 lines of code)
    • 32 medium size units (978 lines of code)
    • 89 small units (1,277 lines of code)
    • 366 very small units (1,628 lines of code)
7% | 5% | 21% | 28% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift8% | 4% | 21% | 29% | 35%
py0% | 26% | 19% | 9% | 43%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
PlaygroundLogger/PlaygroundLoggerTests8% | 6% | 37% | 28% | 19%
PlaygroundLogger/PlaygroundLogger15% | 0% | 9% | 29% | 45%
Legacy/PlaygroundLogger5% | 6% | 15% | 25% | 46%
PlaygroundSupport/XCPlaygroundTests0% | 0% | 0% | 80% | 19%
PlaygroundSupport/PlaygroundSupportTests0% | 0% | 0% | 100% | 0%
PlaygroundSupport/XCPlayground0% | 0% | 0% | 0% | 100%
PlaygroundLogger/PlaygroundLoggerTestHost_iOS0% | 0% | 0% | 0% | 100%
PlaygroundLogger/PlaygroundLoggerTestHost_tvOS0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func testMaximumDepthLimitTwoWithSuperclasses()
in PlaygroundLogger/PlaygroundLoggerTests/LogPolicyTests.swift
131 13 0
func opaqueRepresentation()
in PlaygroundLogger/PlaygroundLogger/LegacySupport/PlaygroundQuickLook+OpaqueRepresentationSupport.swift
112 29 0
func encode()
in Legacy/PlaygroundLogger/PlaygroundLogger/QuickLookEncoder.swift
111 27 0
def main()
in Legacy/PlaygroundLogger/build.py
82 6 0
func CGColorSpaceCopyName()
in Legacy/PlaygroundLogger/PlaygroundLogger/ExtensionCGColorRef.swift
64 11 1
func testBaseTypesDecoding()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
55 1 0
func testImageLogging()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
52 4 0
func testContainerChildPolicyHeadTail()
in PlaygroundLogger/PlaygroundLoggerTests/LogPolicyTests.swift
48 7 0
func testAggregateChildPolicyHeadTail()
in PlaygroundLogger/PlaygroundLoggerTests/LogPolicyTests.swift
42 6 0
def parse()
in Legacy/PlaygroundLogger/build.py
39 13 2
func encode()
in Legacy/PlaygroundLogger/PlaygroundLogger/PlaygroundObjectWriter.swift
38 6 2
func encode()
in Legacy/PlaygroundLogger/PlaygroundLogger/PlaygroundObjectWriter.swift
36 8 3
func testEnumSummary_Generic()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
36 1 0
func testEnumSummary_NotGeneric()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
36 1 0
init()
in Legacy/PlaygroundLogger/PlaygroundLogger/LoggerDecoderImpl.swift
35 1 1
func testContainerChildPolicyHead()
in PlaygroundLogger/PlaygroundLoggerTests/LogPolicyTests.swift
35 5 0
func testStructuredTypesDecoding()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
34 1 0
func testFloatDoubleDecoding()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
34 1 0
func logPostPrint()
in PlaygroundLogger/PlaygroundLogger/LoggerEntrypoints.swift
33 5 4
func testBaseClassLogging()
in PlaygroundLogger/PlaygroundLoggerTests/LegacyPlaygroundLoggerTests.swift
33 11 0