microsoft / microsoft-ui-xaml
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 13,143 units with 174,403 lines of code in units (53.2% of code).
    • 112 very long units (16,568 lines of code)
    • 427 long units (28,912 lines of code)
    • 1,626 medium size units (50,670 lines of code)
    • 2,329 small units (34,069 lines of code)
    • 8,649 very small units (44,184 lines of code)
9% | 16% | 29% | 19% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp10% | 14% | 24% | 19% | 30%
cs8% | 19% | 34% | 19% | 18%
h4% | 2% | 16% | 22% | 53%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
dev/Generated21% | 6% | 8% | 4% | 59%
dev/ScrollPresenter11% | 24% | 32% | 17% | 14%
dev/Repeater12% | 23% | 28% | 16% | 18%
dev/WebView222% | 12% | 23% | 26% | 15%
dev/ColorPicker23% | 20% | 19% | 20% | 16%
dev/NavigationView4% | 14% | 37% | 22% | 21%
dev/ParallaxView12% | 28% | 26% | 19% | 13%
dev/TeachingTip11% | 19% | 21% | 20% | 27%
dev/CommandBarFlyout12% | 32% | 31% | 11% | 12%
dev/Lights19% | 5% | 31% | 20% | 22%
dev/ScrollView6% | 16% | 27% | 29% | 20%
dev/AnimatedIcon6% | 3% | 14% | 26% | 48%
dev/SwipeControl6% | 18% | 43% | 16% | 15%
dev/dll13% | 19% | 20% | 21% | 25%
dev/PersonPicture13% | 13% | 50% | 13% | 9%
dev/Materials2% | 13% | 34% | 24% | 24%
dev/TabView4% | 11% | 36% | 21% | 25%
dev/CommonStyles7% | 8% | 30% | 26% | 27%
dev/PullToRefresh3% | 19% | 31% | 21% | 24%
dev/TreeView0% | 10% | 39% | 25% | 24%
dev/RatingControl0% | 19% | 39% | 21% | 19%
dev/PagerControl0% | 19% | 31% | 23% | 25%
dev/RadioButtons0% | 17% | 34% | 19% | 29%
dev/NumberBox0% | 22% | 35% | 22% | 19%
tools/CustomTasks0% | 29% | 41% | 17% | 11%
dev/Breadcrumb0% | 8% | 41% | 25% | 23%
dev/AnimatedVisualPlayer0% | 21% | 28% | 23% | 26%
dev/TwoPaneView0% | 18% | 37% | 16% | 27%
dev/Common0% | 39% | 22% | 13% | 24%
dev/Interactions0% | 14% | 30% | 32% | 22%
dev/InfoBar0% | 15% | 30% | 23% | 30%
dev/PipsPager0% | 7% | 35% | 24% | 32%
dev/SplitButton0% | 11% | 35% | 14% | 38%
dev/GeneratedExperimental0% | 23% | 12% | 4% | 59%
dev/Telemetry0% | 21% | 29% | 31% | 17%
dev/inc0% | 5% | 23% | 27% | 42%
dev/IconSource0% | 13% | 48% | 27% | 10%
dev/ProgressBar0% | 8% | 51% | 14% | 25%
dev/InfoBadge0% | 18% | 31% | 17% | 31%
dev/MenuBar0% | 0% | 46% | 26% | 27%
dev/LayoutPanel0% | 0% | 84% | 3% | 11%
dev/ProgressRing0% | 0% | 21% | 25% | 52%
dev/ComboBox0% | 0% | 67% | 13% | 18%
dev/Effects0% | 0% | 27% | 55% | 16%
dev/Expander0% | 0% | 32% | 27% | 40%
dev/TestHooks0% | 0% | 49% | 17% | 32%
dev/RadialGradientBrush0% | 0% | 22% | 37% | 39%
dev/TitleBar0% | 0% | 33% | 32% | 33%
dev/AutoSuggestBox0% | 0% | 45% | 38% | 16%
dev/RadioMenuFlyoutItem0% | 0% | 31% | 59% | 8%
dev/MonochromaticOverlayPresenter0% | 0% | 64% | 18% | 17%
dev/ResourceHelper0% | 0% | 24% | 50% | 25%
dev/DropDownButton0% | 0% | 16% | 10% | 73%
dev/ImageIcon0% | 0% | 35% | 18% | 45%
tools/MUXBaselineResourcesGenerator0% | 0% | 29% | 19% | 51%
dev/Collections0% | 0% | 0% | 35% | 64%
dev/CommonManaged0% | 0% | 0% | 19% | 80%
dev/SplitView0% | 0% | 0% | 37% | 62%
dev/SampleControl0% | 0% | 0% | 0% | 100%
tools/GenerateNewControlProjectFiles0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
async public void CompleteCurrentTest()
in dev/WebView2/TestUI/WebView2BasicPage.xaml.cs
499 43 2
void NavigationViewProperties::EnsureProperties()
in dev/Generated/NavigationView.properties.cpp
410 38 0
public void BasicCoreObjectCreationAndDestructionTest()
in dev/WebView2/InteractionTests/WebView2Tests.cs
342 6 0
private Color GetNewColor()
in dev/ScrollPresenter/TestUI/ScrollPresenterScrollSnapPointsPage.xaml.cs
285 139 0
void NavigationView::OnApplyTemplate()
in dev/NavigationView/NavigationView.cpp
244 32 0
238 1 0
void CommandBarFlyoutCommandBarTemplateSettingsProperties::EnsureProperties()
in dev/Generated/CommandBarFlyoutCommandBarTemplateSettings.properties.cpp
234 22 0
void NumberBoxProperties::EnsureProperties()
in dev/Generated/NumberBox.properties.cpp
234 22 0
void TeachingTipProperties::EnsureProperties()
in dev/Generated/TeachingTip.properties.cpp
234 22 0
winrt::Size ScrollPresenter::ArrangeOverride()
in dev/ScrollPresenter/ScrollPresenter.cpp
229 46 1
void ColorPickerProperties::EnsureProperties()
in dev/Generated/ColorPicker.properties.cpp
223 21 0
void PagerControlProperties::EnsureProperties()
in dev/Generated/PagerControl.properties.cpp
223 21 0
void ScrollViewProperties::EnsureProperties()
in dev/Generated/ScrollView.properties.cpp
223 21 0
void ColorSpectrum::CreateBitmapsAndColorMap()
in dev/ColorPicker/ColorSpectrum.cpp
213 45 0
void TabViewProperties::EnsureProperties()
in dev/Generated/TabView.properties.cpp
201 19 0
void VerifyLights()
in dev/Lights/ApiTests/Lights_ApiTests/LightConfigurationTests.cs
193 8 3
CharacterType InitialsGenerator::GetCharacterType()
in dev/PersonPicture/InitialsGenerator.cpp
188 93 1
void ColorSpectrum::UpdateBitmapSources()
in dev/ColorPicker/ColorSpectrum.cpp
186 52 0
void ColorPicker::OnApplyTemplate()
in dev/ColorPicker/ColorPicker.cpp
185 53 0
winrt::ICommandBarElement TextCommandBarFlyout::GetButton()
in dev/CommandBarFlyout/TextCommandBarFlyout.cpp
183 17 1