microsoft / terminal
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 12,537 units with 149,376 lines of code in units (46.5% of code).
    • 116 very long units (17,169 lines of code)
    • 404 long units (27,488 lines of code)
    • 1,323 medium size units (40,769 lines of code)
    • 1,760 small units (25,650 lines of code)
    • 8,934 very small units (38,300 lines of code)
11% | 18% | 27% | 17% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp14% | 23% | 30% | 16% | 16%
cs16% | 13% | 34% | 15% | 20%
hpp2% | 5% | 18% | 20% | 51%
h3% | 5% | 16% | 19% | 54%
ipp0% | 0% | 71% | 12% | 15%
cc0% | 0% | 27% | 36% | 36%
py0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/cascadia10% | 21% | 31% | 17% | 18%
src/host14% | 27% | 31% | 12% | 14%
src/propsheet54% | 18% | 14% | 9% | 3%
src/terminal11% | 16% | 30% | 16% | 24%
src/tools24% | 18% | 27% | 17% | 12%
src/interactivity21% | 16% | 24% | 19% | 18%
dep/CLI1112% | 11% | 31% | 23% | 20%
src/types9% | 21% | 25% | 23% | 19%
src/buffer12% | 7% | 24% | 21% | 33%
src/renderer7% | 22% | 24% | 18% | 26%
oss/fmt3% | 10% | 18% | 16% | 50%
dep/jsoncpp5% | 20% | 29% | 22% | 22%
build/Helix44% | 16% | 20% | 8% | 10%
src/server21% | 36% | 11% | 12% | 18%
src/winconpty25% | 11% | 48% | 10% | 5%
src/inc4% | 4% | 17% | 13% | 59%
oss/boost<1% | 4% | 15% | 20% | 58%
src/tsf0% | 39% | 25% | 14% | 20%
src/propslib0% | 18% | 52% | 13% | 15%
oss/libpopcnt0% | 13% | 48% | 18% | 19%
src/til0% | 0% | 58% | 22% | 18%
oss/dynamic_bitset0% | 0% | 44% | 27% | 28%
oss/chromium0% | 0% | 11% | 12% | 76%
scratch/ScratchIslandApp0% | 0% | 8% | 36% | 55%
oss/interval_tree0% | 0% | 0% | 50% | 49%
src/api-ms-win-core-synch-l1-2-00% | 0% | 0% | 61% | 38%
oss/pcg0% | 0% | 0% | 35% | 64%
tools0% | 0% | 0% | 0% | 100%
src/internal0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static void Main()
in src/tools/vtapp/Program.cs
368 85 1
DWORD GetRegistryValues()
in src/propsheet/registry.cpp
352 38 1
void TerminalSettingsTests::TestTerminalArgsForBinding()
in src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp
296 1 0
BOOL HandleMouseEvent()
in src/interactivity/win32/windowio.cpp
296 70 4
bool COOKED_READ_DATA::ProcessInput()
in src/host/readDataCooked.cpp
280 51 3
VOID SetRegistryValues()
in src/propsheet/registry.cpp
261 10 2
void HandleKeyEvent()
in src/interactivity/win32/windowio.cpp
251 84 5
void CommandlineTest::ParseNewTabCommand()
in src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp
231 2 0
void SettingsTests::TestElevateArg()
in src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
223 1 0
void RemotingTests::TestSummonOnCurrent()
in src/cascadia/UnitTests_Remoting/RemotingTests.cpp
221 22 0
void ConsoleArgumentsTests::ClientCommandlineTests()
in src/host/ut_host/ConsoleArgumentsTests.cpp
214 1 0
void ConsoleArgumentsTests::LegacyFormatsTests()
in src/host/ut_host/ConsoleArgumentsTests.cpp
214 1 0
void TextBufferTests::GetText()
in src/host/ut_host/TextBufferTests.cpp
214 16 0
211 44 1
public static TestPass ParseTestWttFile()
in build/Helix/HelixTestHelpers.cs
198 59 3
bool OutputStateMachineEngine::ActionCsiDispatch()
in src/terminal/parser/OutputStateMachineEngine.cpp
196 53 2
void ConsoleArgumentsTests::ArgSplittingTests()
in src/host/ut_host/ConsoleArgumentsTests.cpp
193 1 0
int FindCreateFont()
in src/propsheet/fontdlg.cpp
191 49 2
INT_PTR WINAPI ColorDlgProc()
in src/propsheet/ColorsPage.cpp
188 38 4
bool AdaptDispatch::SetGraphicsRendition()
in src/terminal/adapter/adaptDispatchGraphics.cpp
187 59 1