microsoft / vs-threading
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 793 units with 11,726 lines of code in units (63.4% of code).
    • 4 very long units (498 lines of code)
    • 31 long units (2,082 lines of code)
    • 135 medium size units (4,025 lines of code)
    • 182 small units (2,610 lines of code)
    • 441 very small units (2,511 lines of code)
4% | 17% | 34% | 22% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs4% | 17% | 34% | 22% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/Microsoft.VisualStudio.Threading.Analyzers.CSharp14% | 11% | 37% | 21% | 15%
src/SosThreadingTools18% | 24% | 28% | 16% | 11%
src/Microsoft.VisualStudio.Threading1% | 18% | 33% | 21% | 24%
src/Microsoft.VisualStudio.Threading.Analyzers.CodeFixes13% | 34% | 34% | 9% | 7%
src/Microsoft.VisualStudio.Threading.Analyzers.VisualBasic0% | 79% | 0% | 0% | 20%
src/Microsoft.VisualStudio.Threading.Analyzers0% | 0% | 40% | 37% | 22%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private Diagnostic? AnalyzeAwaitedOrReturnedExpression()
in src/Microsoft.VisualStudio.Threading.Analyzers.CSharp/VSTHRD003UseJtfRunAsyncAnalyzer.cs
148 50 3
private static void GetAllStateMachines()
in src/SosThreadingTools/DumpAsyncCommand.cs
124 29 4
internal void Post()
in src/Microsoft.VisualStudio.Threading/JoinableTask.cs
117 29 3
public override async Task RegisterCodeFixesAsync()
in src/Microsoft.VisualStudio.Threading.Analyzers.CodeFixes/VSTHRD109AvoidAssertInAsyncMethodsCodeFix.cs
109 22 1
private bool TryIssueLock()
in src/Microsoft.VisualStudio.Threading/AsyncReaderWriterLock.cs
98 32 3
public override async Task RegisterCodeFixesAsync()
in src/Microsoft.VisualStudio.Threading.Analyzers.CodeFixes/VSTHRD010MainThreadUsageCodeFix.cs
94 21 1
private Task ReleaseAsync()
in src/Microsoft.VisualStudio.Threading/AsyncReaderWriterLock.cs
88 27 2
internal bool TryJoinComputation()
in src/Microsoft.VisualStudio.Threading/CancellableJoinComputation.cs
86 13 2
public override async Task ExecuteAsync()
in src/Microsoft.VisualStudio.Threading/ReentrantSemaphore.cs
86 10 2
public override async ValueTask ExecuteAsync()
in src/Microsoft.VisualStudio.Threading/ReentrantSemaphore.cs
86 10 2
internal void CompleteOnCurrentThread()
in src/Microsoft.VisualStudio.Threading/JoinableTask.cs
83 12 0
public static CombinedCancellationToken CombineWith()
in src/Microsoft.VisualStudio.Threading/CancellationTokenExtensions.cs
72 19 2
public override async Task ExecuteAsync()
in src/Microsoft.VisualStudio.Threading/ReentrantSemaphore.cs
71 9 2
public override async ValueTask ExecuteAsync()
in src/Microsoft.VisualStudio.Threading/ReentrantSemaphore.cs
71 9 2
internal CancellableJoinComputation()
in src/Microsoft.VisualStudio.Threading/CancellableJoinComputation.cs
69 9 2
protected override async Task GetChangedSolutionAsync()
in src/Microsoft.VisualStudio.Threading.Analyzers.CodeFixes/VSTHRD103UseAsyncOptionCodeFix.cs
68 7 1
private bool TryDequeueSelfOrDependencies()
in src/Microsoft.VisualStudio.Threading/JoinableTask.cs
67 19 3
private static void RemoveDependingSynchronousTask()
in src/Microsoft.VisualStudio.Threading/JoinableTaskDependencyGraph.cs
65 16 4
private static bool TryFindNodeAtSource()
in src/Microsoft.VisualStudio.Threading.Analyzers.CodeFixes/VSTHRD002UseJtfRunCodeFixWithAwait.cs
64 6 3
public Task GetValueAsync()
in src/Microsoft.VisualStudio.Threading/AsyncLazy`1.cs
62 9 1