microsoft / PowerToys
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 4,384 units with 63,410 lines of code in units (36.0% of code).
    • 38 very long units (5,549 lines of code)
    • 145 long units (9,825 lines of code)
    • 637 medium size units (19,497 lines of code)
    • 1,006 small units (14,527 lines of code)
    • 2,558 very small units (14,012 lines of code)
8% | 15% | 30% | 22% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp14% | 18% | 31% | 21% | 15%
cs3% | 13% | 30% | 24% | 28%
h0% | 9% | 33% | 26% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/modules9% | 15% | 30% | 23% | 20%
src/runner22% | 23% | 30% | 14% | 9%
src/common6% | 12% | 30% | 27% | 22%
installer/PowerToysSetupCustomActions23% | 29% | 21% | 23% | 2%
src/settings-ui3% | 7% | 22% | 20% | 46%
tools/BugReportTool0% | 33% | 45% | 15% | 5%
tools/WebcamReportTool0% | 66% | 14% | 6% | 11%
src/ActionRunner0% | 100% | 0% | 0% | 0%
tools/FancyZone_HitTest0% | 60% | 24% | 0% | 14%
tools/CleanUp_tool0% | 44% | 47% | 0% | 8%
tools/FancyZones_DrawLayoutTest0% | 0% | 61% | 15% | 22%
tools/FancyZones_zonable_tester0% | 0% | 72% | 27% | 0%
src/Update0% | 0% | 93% | 6% | 0%
tools/project_template0% | 0% | 0% | 56% | 43%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
intptr_t HandleShortcutRemapEvent()
in src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp
403 95 4
void D2DOverlayWindow::render()
in src/modules/ShortcutGuide/ShortcutGuide/overlay_window.cpp
252 53 1
inline void CreateEditShortcutsWindowImpl()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp
207 11 3
inline void CreateEditKeyboardWindowImpl()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp
194 9 3
std::pair ValidateShortcutBufferElement()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp
187 65 8
UINT __stdcall CreateScheduledTaskCA()
in installer/PowerToysSetupCustomActions/CustomAction.cpp
184 19 1
HRESULT GetTransformedFileName()
in src/modules/powerrename/lib/Helpers.cpp
184 51 5
DWORD WINAPI CPowerRenameManager::s_regexWorkerThread()
in src/modules/powerrename/lib/PowerRenameManager.cpp
180 50 1
public OobeShellPage()
in src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
165 1 0
void ShortcutControl::CreateDetectShortcutWindow()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp
164 5 12
bool create_auto_start_task_for_this_user()
in src/runner/auto_start_helper.cpp
159 15 1
void LayoutMap::LayoutMapImpl::UpdateLayout()
in src/common/interop/keyboard_layout.cpp
151 7 0
void ShortcutControl::AddNewShortcutControlRow()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp
148 16 5
BOOL GetEnumeratedFileName()
in src/modules/powerrename/lib/Helpers.cpp
146 33 1
void notifications::show_toast_with_activations()
in src/common/notifications/notifications.cpp
141 19 5
bool Shortcut::IsKeyboardStateClearExceptShortcut()
in src/modules/keyboardmanager/common/Shortcut.cpp
139 35 1
public static void Update()
in src/modules/launcher/Wox.Plugin/SharedCommands/DefaultBrowserInfo.cs
134 18 0
void SingleKeyRemapControl::createDetectKeyWindow()
in src/modules/keyboardmanager/KeyboardManagerEditorLibrary/SingleKeyRemapControl.cpp
131 3 3
LRESULT Toolbar::WindowProcessMessages()
in src/modules/videoconference/VideoConferenceModule/Toolbar.cpp
129 25 4
void run_settings_window()
in src/runner/settings_window.cpp
129 24 2