apple / swift-corelibs-xctest
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 107 units with 730 lines of code in units (25.3% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (70 lines of code)
    • 4 medium size units (116 lines of code)
    • 14 small units (196 lines of code)
    • 88 very small units (348 lines of code)
0% | 9% | 15% | 26% | 47%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 31% | 42% | 12% | 13%
swift0% | 0% | 4% | 33% | 62%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT0% | 31% | 42% | 12% | 13%
Sources/XCTest/Private0% | 0% | 7% | 27% | 65%
Sources/XCTest/Public0% | 0% | 0% | 48% | 51%
Sources/XCTest/Public/Asynchronous0% | 0% | 0% | 20% | 79%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def build()
in build_script.py
70 12 1
def test()
in build_script.py
47 5 1
def install()
in build_script.py
26 2 1
def build()
in build_script.py
22 3 1
func startManaging()
in Sources/XCTest/Private/WaiterManager.swift
21 3 2
func awaitUsingExpectation()
in Sources/XCTest/Public/XCTestCase.swift
18 3 1
def test()
in build_script.py
18 2 1
func testSuiteDidFinish()
in Sources/XCTest/Private/PrintObserver.swift
16 5 1
func recordFailure()
in Sources/XCTest/Public/XCTestRun.swift
15 2 4
func recordSkip()
in Sources/XCTest/Public/XCTestRun.swift
15 1 2
func testCaseDidFinish()
in Sources/XCTest/Private/PrintObserver.swift
14 3 1
func stopManaging()
in Sources/XCTest/Private/WaiterManager.swift
14 1 1
func failureDescription()
in Sources/XCTest/Public/XCTAssert.swift
14 6 1
init?()
in Sources/XCTest/Private/TestFiltering.swift
13 3 1
func queue_handleWatchdogTimeout()
in Sources/XCTest/Private/WaiterManager.swift
13 2 1
func failIfExpectationsNotWaitedFor()
in Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift
12 1 1
func handleErrorDuringSetUp()
in Sources/XCTest/Public/XCTestCase.swift
12 4 1
func calculateResults()
in Sources/XCTest/Private/WallClockTimeMetric.swift
11 1 0
def symlink_force()
in build_script.py
11 4 2
func printTestList()
in Sources/XCTest/Private/TestListing.swift
9 3 0