microsoft / Omex
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 191 units with 2,609 lines of code in units (50.3% of code).
    • 1 very long units (110 lines of code)
    • 3 long units (198 lines of code)
    • 32 medium size units (920 lines of code)
    • 49 small units (730 lines of code)
    • 106 very small units (651 lines of code)
4% | 7% | 35% | 27% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs4% | 7% | 35% | 27% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/Logging24% | 14% | 15% | 21% | 25%
src/Activities0% | 20% | 39% | 14% | 24%
src/Hosting.Services.Web0% | 15% | 33% | 33% | 17%
src/Diagnostics.HealthChecks0% | 0% | 43% | 36% | 19%
src/CodeGenerators0% | 0% | 50% | 36% | 13%
src/Services.Remoting0% | 0% | 36% | 41% | 22%
src/Hosting.Services0% | 0% | 31% | 23% | 44%
src/Hosting0% | 0% | 39% | 40% | 20%
src/Abstractions0% | 0% | 38% | 30% | 31%
src/ServiceFabricGuest.Abstractions0% | 0% | 43% | 0% | 56%
src/Testing.Helpers0% | 0% | 55% | 0% | 45%
src/Hosting.Services.Remoting0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public void LogErrorServiceMessage()
in src/Logging/Internal/EventSource/OmexLogEventSource.cs
110 1 18
public void SendActivityMetric()
in src/Activities/Internal/EventSource/ActivityEventSender.cs
75 8 1
public void LogMessage()
in src/Logging/Internal/EventSource/OmexLogEventSender.cs
64 12 7
public static IHost BuildStatelessWebService()
in src/Hosting.Services.Web/HostBuilderExtensions.cs
59 5 6
public static IHealthChecksBuilder AddHttpEndpointCheck()
in src/Diagnostics.HealthChecks/HealthChecksBuilderExtensions.cs
47 8 11
private static IHost BuildServiceFabricService()
in src/Hosting.Services/HostBuilderExtensions.cs
44 3 3
public static string ToTagId()
in src/Logging/TagsExtensions.cs
44 7 1
protected string BuildHealthSummaryDescription()
in src/Diagnostics.HealthChecks/Internal/OmexHealthCheckPublisher.cs
42 5 1
public void OnStart()
in src/Activities/Internal/ActivityObserver.cs
39 6 2
public static IApplicationBuilder UseActivityEnrichmentMiddleware()
in src/Hosting.Services.Web/ApplicationBuilderExtensions.cs
39 2 1
public void Execute()
in src/CodeGenerators/SettingsGen/BaseGenerator.cs
36 7 1
public IList GetAttributes()
in src/CodeGenerators/SettingsGen/Wrappers/GeneratorSyntaxContextWrapper.cs
36 9 1
protected override bool ShouldGenerateFile()
in src/CodeGenerators/SettingsGen/SettingsGenerator.cs
34 7 2
public BaseExecutionContext()
in src/Abstractions/ExecutionContext/BaseExecutionContext.cs
31 3 1
public void SendActivityMetric()
in src/Activities/Internal/ActivityMetricsSender.cs
29 5 1
protected override async Task CheckHealthInternalAsync()
in src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs
29 5 2
private void OnException()
in src/Activities/Internal/DiagnosticsListener/DiagnosticsObserversInitializer.cs
28 4 2
public static IHost BuildStatelessService()
in src/Hosting.Services/HostBuilderExtensions.cs
28 2 3
public static Activity? StartActivityFromIncomingRequest()
in src/Services.Remoting/OmexRemotingHeadersExtensions.cs
28 6 3
private static HttpRequestMessage CloneRequestMessage()
in src/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs
27 5 1