apple / swift-argument-parser
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 196 units with 1,862 lines of code in units (32.1% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (188 lines of code)
    • 17 medium size units (525 lines of code)
    • 28 small units (388 lines of code)
    • 149 very small units (761 lines of code)
0% | 10% | 28% | 20% | 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% | 10% | 28% | 20% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/ArgumentParser/Parsing0% | 10% | 26% | 16% | 45%
Sources/ArgumentParser/Usage0% | 14% | 32% | 22% | 30%
Sources/ArgumentParser/Parsable Types0% | 0% | 52% | 0% | 47%
Sources/ArgumentParser/Utilities0% | 0% | 23% | 47% | 28%
Sources/ArgumentParser/Completions0% | 0% | 30% | 35% | 34%
Sources/ArgumentParser/Parsable Properties0% | 0% | 0% | 100% | 0%
Tools/changelog-authors0% | 0% | 0% | 0% | 100%
Sources/ArgumentParserTestHelpers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func parseValue()
in Sources/ArgumentParser/Parsing/ArgumentSet.swift
97 20 6
init()
in Sources/ArgumentParser/Usage/MessageInfo.swift
91 24 2
func makeErrorMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
50 21 0
func lenientParse()
in Sources/ArgumentParser/Parsing/ArgumentSet.swift
44 11 1
func parseIndividualArg()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
42 10 2
func handleCustomCompletion()
in Sources/ArgumentParser/Parsing/CommandParser.swift
35 8 1
init()
in Sources/ArgumentParser/Parsable Types/ParsableArguments.swift
34 5 2
mutating func parse()
in Sources/ArgumentParser/Parsing/CommandParser.swift
34 10 1
init()
in Sources/ArgumentParser/Usage/DumpHelpGenerator.swift
30 2 1
func coalescedExtraElements()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
29 8 0
func zshCompletionString()
in Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift
27 5 1
func editDistance()
in Sources/ArgumentParser/Utilities/StringExtensions.swift
27 8 1
func parsePositionalValues()
in Sources/ArgumentParser/Parsing/ArgumentSet.swift
26 5 2
init()
in Sources/ArgumentParser/Usage/HelpGenerator.swift
26 6 1
func mergingCompositeArguments()
in Sources/ArgumentParser/Usage/DumpHelpGenerator.swift
25 5 0
func _terminalSize()
in Sources/ArgumentParser/Usage/HelpGenerator.swift
25 3 0
func unknownOptionMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
24 7 2
func unableToParseValueMessage()
in Sources/ArgumentParser/Usage/UsageGenerator.swift
24 7 5
mutating func remove()
in Sources/ArgumentParser/Parsing/SplitArguments.swift
23 8 1
func zshActionString()
in Sources/ArgumentParser/Completions/ZshCompletionsGenerator.swift
20 8 1