microsoft / TemplateStudio
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,907 units with 38,311 lines of code in units (33.1% of code).
    • 8 very long units (2,784 lines of code)
    • 11 long units (683 lines of code)
    • 196 medium size units (5,425 lines of code)
    • 679 small units (9,804 lines of code)
    • 4,013 very small units (19,615 lines of code)
7% | 1% | 14% | 25% | 51%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs6% | 1% | 15% | 27% | 48%
vb9% | 1% | 6% | 14% | 67%
cpp0% | 0% | 32% | 0% | 67%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
templates/Uwp6% | 1% | 10% | 21% | 59%
templates/WinUI32% | 0% | 8% | 15% | 43%
templates/Wpf8% | 0% | 10% | 26% | 54%
code/tools15% | 0% | 22% | 34% | 26%
code/src0% | 5% | 25% | 35% | 33%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private static IEnumerable AllCompanies()
in templates/WinUI/Features/SampleData/Param_ProjectName.Core/Services/SampleDataService.cs
470 1 0
private IEnumerable AllCompanies()
in templates/Uwp/Services/SampleData.Prism/Param_ProjectName.Core/Services/SampleDataService.cs
462 1 0
private static IEnumerable AllCompanies()
in templates/Uwp/Services/SampleData/Param_ProjectName.Core/Services/SampleDataService.cs
462 1 0
private static IEnumerable AllCompanies()
in templates/Wpf/Features/SampleData/Param_ProjectName.Core/Services/SampleDataService.cs
462 1 0
Public Function AllCompanies()
in templates/Uwp/Services/SampleData._VB/Param_ProjectName.Core/Services/SampleDataService.vb
414 1 0
public static VerifierResult VerifyTemplateFolders()
in code/tools/TemplateValidator/TemplateFolderVerifier.cs
256 68 2
Public Async Function AllCompanies()
in templates/Uwp/Services/SqlServerDataService._VB/Param_ProjectName.Core/Services/SqlServerDataService.vb
132 7 0
private static void VerifyTagUsage()
in code/tools/TemplateValidator/TemplateJsonVerifier.cs
126 42 2
private void SetCommonControlColors()
in code/src/UI/Services/Styles/UIStylesService.cs
89 1 0
Await Task.Run()
in templates/Uwp/_comp/_shared/Page.Camera.AddResource._VB/Controls/CameraControl.xaml.vb
74 8 1
public IEnumerable GetPageNames()
in code/src/UI/ViewModels/NewProject/UserSelectionViewModel.cs
70 14 0
public void SampleUpdate()
in templates/Uwp/Features/LiveTile.Prism/Services/LiveTileFeatureService.Samples.cs
62 1 0
public void SampleUpdate()
in templates/Uwp/Features/LiveTile/Services/LiveTileFeatureService.Samples.cs
62 1 0
private string Normalize()
in code/src/UI/Controls/Markdown.cs
60 15 1
private async Task AddContextItemsToSolutionAsync()
in code/src/UI/VisualStudio/GenShell/VsGenShellSolution.cs
56 10 1
private void OnDrop()
in code/src/UI/Services/DragAndDropService/DragAndDropService.cs
55 11 2
private Inline ImageInlineEvaluator()
in code/src/UI/Controls/Markdown.cs
52 7 1
public static IServiceCollection ProtectWebApiWithJwtBearer()
in templates/Uwp/_comp/_shared/Services.SecuredWebApi/Param_ProjectName.WebApi/Extensions/ServiceCollectionExtensions.cs
52 1 2
private void SetWindowsTemplateStudioColors()
in code/src/UI/Services/Styles/UIStylesService.cs
51 1 0
public static void SetData()
in templates/Uwp/Features/ShareSource/Helpers/DataRequestExtensions.cs
50 11 2