apple / swift-tools-support-core
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 217 units with 1,944 lines of code in units (15.3% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (157 lines of code)
    • 15 medium size units (418 lines of code)
    • 40 small units (586 lines of code)
    • 159 very small units (783 lines of code)
0% | 8% | 21% | 30% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift0% | 8% | 22% | 28% | 40%
py0% | 0% | 14% | 46% | 38%
c0% | 0% | 0% | 88% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/TSCUtility0% | 13% | 18% | 26% | 42%
Sources/TSCBasic0% | 5% | 26% | 28% | 39%
Utilities0% | 0% | 14% | 46% | 38%
Sources/TSCclibc0% | 0% | 0% | 88% | 12%
Sources/TSCTestSupport0% | 0% | 0% | 58% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
mutating func withAbbreviatedRecord()
in Sources/TSCUtility/BitstreamReader.swift
53 12 2
init()
in Sources/TSCBasic/Path.swift
52 14 1
mutating func readBlock()
in Sources/TSCUtility/BitstreamReader.swift
52 10 4
mutating func readBlockInfoBlock()
in Sources/TSCUtility/BitstreamReader.swift
50 14 1
init()
in Sources/TSCBasic/Path.swift
49 10 1
func appending()
in Sources/TSCBasic/Path.swift
28 4 1
mutating func readSingleAbbreviatedRecordOperand()
in Sources/TSCUtility/BitstreamReader.swift
28 11 1
func appending()
in Sources/TSCBasic/Path.swift
27 4 1
func search()
in Sources/TSCBasic/DeltaAlgorithm.swift
26 5 3
func strerror()
in Sources/TSCBasic/misc.swift
26 5 1
func readFileContents()
in Sources/TSCBasic/FileSystem.swift
25 7 1
func suffix()
in Sources/TSCBasic/Path.swift
25 7 1
func quote()
in Sources/TSCBasic/misc.swift
24 4 1
mutating func readAbbrevOp()
in Sources/TSCUtility/BitstreamReader.swift
24 9 0
func readBits()
in Sources/TSCUtility/Bits.swift
23 5 2
func getNodeInternal()
in Sources/TSCBasic/FileSystem.swift
21 7 1
func getFlags()
in Sources/TSCUtility/PkgConfig.swift
21 3 1
def build_with_cmake()
in Utilities/build-script-helper.py
21 7 4
func split()
in Sources/TSCBasic/DeltaAlgorithm.swift
20 5 1
init()
in Sources/TSCBasic/Path.swift
20 4 1