apple / sourcekit-lsp
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 234 units with 3,082 lines of code in units (21.0% of code).
    • 0 very long units (0 lines of code)
    • 8 long units (468 lines of code)
    • 40 medium size units (1,256 lines of code)
    • 45 small units (680 lines of code)
    • 141 very small units (678 lines of code)
0% | 15% | 40% | 22% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift0% | 14% | 40% | 23% | 20%
py0% | 31% | 45% | 0% | 22%
cpp0% | 0% | 0% | 0% | 100%
c0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/SourceKitLSP0% | 16% | 46% | 19% | 16%
Sources/LanguageServerProtocolJSONRPC0% | 57% | 29% | 0% | 13%
Utilities0% | 34% | 49% | 0% | 15%
Sources/SKCore0% | 0% | 15% | 63% | 20%
Sources/SKSwiftPMWorkspace0% | 0% | 73% | 0% | 26%
Sources/sourcekit-lsp0% | 0% | 68% | 31% | 0%
Sources/SourceKitD0% | 0% | 56% | 0% | 43%
Sources/SKTestSupport0% | 0% | 0% | 11% | 88%
Sources/LanguageServerProtocol0% | 0% | 0% | 0% | 100%
Sources/SKSupport0% | 0% | 0% | 0% | 100%
Sources/CSKTestSupport0% | 0% | 0% | 0% | 100%
Sources/LSPLogging0% | 0% | 0% | 0% | 100%
Sources/LSPTestSupport0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
mutating func toMarkdown()
in Sources/SourceKitLSP/Swift/CommentXML.swift
85 21 1
func _cursorInfo()
in Sources/SourceKitLSP/Swift/CursorInfo.swift
60 4 3
func parseAndHandleMessages()
in Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift
56 12 1
func initialize()
in Sources/SourceKitLSP/SourceKitServer.swift
56 16 1
func definition()
in Sources/SourceKitLSP/SourceKitServer.swift
53 5 3
func completionsFromSKDResponse()
in Sources/SourceKitLSP/Swift/CodeCompletion.swift
53 6 5
def main()
in Utilities/build-script-helper.py
53 9 0
func asCompletionItemKind()
in Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
52 22 1
func reloadPackage()
in Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift
48 3 0
func colorInformation()
in Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
47 6 1
func serverCapabilities()
in Sources/SourceKitLSP/SourceKitServer.swift
45 4 2
func _open()
in Sources/SourceKitLSP/Swift/CodeCompletionSession.swift
45 4 5
func references()
in Sources/SourceKitLSP/SourceKitServer.swift
43 4 3
init?()
in Sources/SourceKitLSP/Swift/Diagnostic.swift
43 6 3
func semanticRefactoring()
in Sources/SourceKitLSP/Swift/SemanticRefactoring.swift
42 2 2
func retrieveQuickFixCodeActions()
in Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
42 7 2
func implementation()
in Sources/SourceKitLSP/SourceKitServer.swift
41 4 3
def handle_invocation()
in Utilities/build-script-helper.py
40 15 2
func languageService()
in Sources/SourceKitLSP/SourceKitServer.swift
36 3 3
func retrieveRefactorCodeActions()
in Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
35 3 2