apple / swift-docc
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 643 units with 6,460 lines of code in units (23.1% of code).
    • 2 very long units (230 lines of code)
    • 7 long units (414 lines of code)
    • 69 medium size units (1,997 lines of code)
    • 115 small units (1,678 lines of code)
    • 450 very small units (2,141 lines of code)
3% | 6% | 30% | 25% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift3% | 5% | 30% | 26% | 33%
py0% | 31% | 34% | 12% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/SwiftDocC/Model14% | 0% | 32% | 28% | 24%
Sources/SwiftDocC/Semantics0% | 10% | 26% | 20% | 43%
Sources/SwiftDocC/Infrastructure0% | 8% | 32% | 33% | 25%
ROOT0% | 31% | 34% | 12% | 22%
Sources/SwiftDocC/LinkTargets0% | 50% | 38% | 0% | 11%
Sources/SwiftDocC/Utility0% | 0% | 30% | 27% | 41%
Sources/SwiftDocC/Indexing0% | 0% | 56% | 11% | 32%
Sources/SwiftDocCUtilities/PreviewServer0% | 0% | 49% | 40% | 9%
Sources/SwiftDocCUtilities/Action0% | 0% | 24% | 31% | 44%
Sources/SwiftDocC/Converter0% | 0% | 71% | 0% | 28%
Sources/SwiftDocC/Checker0% | 0% | 55% | 38% | 6%
Sources/SwiftDocCUtilities/Utility0% | 0% | 0% | 24% | 75%
Sources/SwiftDocCUtilities/ArgumentParsing0% | 0% | 0% | 72% | 27%
Sources/SwiftDocC/DocumentationService0% | 0% | 0% | 29% | 70%
Sources/SwiftDocCTestUtilities0% | 0% | 0% | 0% | 100%
Sources/SwiftDocCUtilities/Transformers0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Benchmark0% | 0% | 0% | 0% | 100%
Sources/SwiftDocC/Servers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
init()
in Sources/SwiftDocC/Model/DocumentationMarkup.swift
118 32 2
init()
in Sources/SwiftDocC/Model/DocumentationNode.swift
112 3 5
func arguments()
in Sources/SwiftDocC/Infrastructure/Diagnostics/ParseDirectiveArguments.swift
68 8 1
init()
in Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift
66 1 6
def run()
in build-script-helper.py
66 13 1
mutating func visitBlockDirective()
in Sources/SwiftDocC/Semantics/SemanticAnalyzer.swift
57 25 1
mutating func loadAll()
in Sources/SwiftDocC/Infrastructure/Symbol Graph/SymbolGraphLoader.swift
53 11 0
mutating func visitSymbol()
in Sources/SwiftDocC/Semantics/ReferenceResolver.swift
52 1 1
mutating func visitDocument()
in Sources/SwiftDocC/Semantics/SemanticAnalyzer.swift
52 10 1
mutating func referenceFromLink()
in Sources/SwiftDocC/Infrastructure/DocumentationCurator.swift
47 11 3
mutating func initializeSymbolContent()
in Sources/SwiftDocC/Model/DocumentationNode.swift
47 5 2
func sendAndWait()
in Sources/SwiftDocC/Infrastructure/External Data/ExternalReferenceResolverServiceClient.swift
45 6 1
func taskGroups()
in Sources/SwiftDocC/Model/Rendering/DocumentationContentRenderer.swift
43 6 1
func mergeDeclaration()
in Sources/SwiftDocC/Semantics/Symbol/Symbol.swift
43 9 4
func __read()
in Sources/SwiftDocC/Indexing/Navigator/NavigatorTree.swift
41 4 0
func separatedForTermDefinition()
in Sources/SwiftDocC/Model/Rendering/Content/Extensions/RenderTermLists.swift
41 10 1
func create()
in Sources/SwiftDocCUtilities/PreviewServer/RequestHandler/FileRequestHandler.swift
41 7 1
func translateSection()
in Sources/SwiftDocC/Model/Rendering/RenderSectionTranslator/DeclarationsSectionTranslator.swift
40 4 3
init()
in Sources/SwiftDocC/Infrastructure/CoverageDataEntry.swift
38 8 1
func channelRead()
in Sources/SwiftDocCUtilities/PreviewServer/PreviewHTTPHandler.swift
38 6 2