apple / swift-integration-tests
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 18 units with 201 lines of code in units (34.2% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (68 lines of code)
    • 1 medium size units (39 lines of code)
    • 2 small units (27 lines of code)
    • 14 very small units (67 lines of code)
0% | 33% | 19% | 13% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 36% | 20% | 14% | 28%
c0% | 0% | 0% | 0% | 100%
swift0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
test-sourcekit-lsp0% | 77% | 0% | 0% | 22%
test-snapshot-binaries0% | 0% | 42% | 29% | 28%
repl0% | 0% | 0% | 0% | 100%
test-complex-xctest-package0% | 0% | 0% | 0% | 100%
test-lldb-with-swiftpm0% | 0% | 0% | 0% | 100%
test-xctest-package0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 18 longest units
Unit# linesMcCabe index# params
def main()
in test-sourcekit-lsp/test-sourcekit-lsp.py
68 2 0
def process_library()
in test-snapshot-binaries/linux_load_commands.py
39 11 2
def regex_string()
in test-snapshot-binaries/linux_load_commands.py
15 5 1
def main()
in test-snapshot-binaries/linux_load_commands.py
12 4 0
def next()
in test-snapshot-binaries/linux_load_commands.py
10 5 1
def debug()
in repl/test-repl-darwin.py
9 1 1
def request()
in test-sourcekit-lsp/test-sourcekit-lsp.py
9 1 3
def get_libraries()
in test-snapshot-binaries/linux_load_commands.py
8 1 1
def note()
in test-sourcekit-lsp/test-sourcekit-lsp.py
7 1 3
def __init__()
in test-snapshot-binaries/linux_load_commands.py
4 2 2
int foo()
in test-complex-xctest-package/SwiftCMixed/Sources/see/see.c
3 1 0
func swiftyFoo()
in test-complex-xctest-package/SwiftCMixed/Sources/swifty/swifty.swift
3 1 0
int see()
in test-lldb-with-swiftpm/Sources/See/see.c
3 1 0
def __init__()
in test-sourcekit-lsp/test-sourcekit-lsp.py
3 1 1
func test_example()
in test-xctest-package/main.swift
3 1 0
def regex()
in test-snapshot-binaries/linux_load_commands.py
2 1 1
def matches()
in test-snapshot-binaries/linux_load_commands.py
2 1 2
void clib_func()
in test-sourcekit-lsp/pkg/Sources/clib/clib.c
1 1 1