bazelbuild / rules_swift
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 50 units with 791 lines of code in units (6.9% of code).
    • 1 very long units (106 lines of code)
    • 2 long units (126 lines of code)
    • 11 medium size units (329 lines of code)
    • 6 small units (94 lines of code)
    • 30 very small units (136 lines of code)
13% | 15% | 41% | 11% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc14% | 17% | 44% | 8% | 15%
h0% | 0% | 0% | 60% | 39%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tools/worker20% | 24% | 41% | 3% | 10%
tools/common0% | 0% | 42% | 27% | 29%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void WorkProcessor::ProcessWorkRequest()
in tools/worker/work_processor.cc
106 23 2
void OutputFileMap::UpdateForIncremental()
in tools/worker/output_file_map.cc
70 13 1
bool SwiftRunner::ProcessArgument()
in tools/worker/swift_runner.cc
56 14 3
int SwiftRunner::Run()
in tools/worker/swift_runner.cc
49 6 2
int RunSubProcess()
in tools/common/process.cc
37 8 3
33 6 2
bool MakeDirs()
in tools/common/file_system.cc
31 9 2
static std::string Unescape()
in tools/worker/swift_runner.cc
29 11 1
std::vector SwiftRunner::ParseArguments()
in tools/worker/swift_runner.cc
29 8 1
bool CopyFile()
in tools/common/file_system.cc
27 4 2
int CompileWithWorker()
in tools/worker/compile_with_worker.cc
26 4 1
std::vector SwiftRunner::ProcessArguments()
in tools/worker/swift_runner.cc
24 4 1
static std::string MakeIncrementalOutputPath()
in tools/worker/output_file_map.cc
22 5 2
std::string ReplaceExtension()
in tools/common/path_utils.cc
22 5 3
static std::unique_ptr WriteResponseFile()
in tools/worker/swift_runner.cc
17 5 1
17 4 1
bool BazelPlaceholderSubstitutions::FindAndReplace()
in tools/common/bazel_substitutions.cc
17 3 3
static std::unique_ptr Create()
in tools/common/temp_file.h
16 3 1
static std::unique_ptr Create()
in tools/common/temp_file.h
15 3 1
explicit PosixSpawnIORedirector()
in tools/common/process.cc
12 2 2