microsoft / dpu-utils
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 434 units with 4,308 lines of code in units (78.5% of code).
    • 2 very long units (232 lines of code)
    • 7 long units (437 lines of code)
    • 36 medium size units (1,001 lines of code)
    • 76 small units (1,060 lines of code)
    • 313 very small units (1,578 lines of code)
5% | 10% | 23% | 24% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 9% | 11% | 27% | 40%
cs0% | 10% | 34% | 22% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
python/dpu_utils/ptutils43% | 0% | 0% | 11% | 45%
python/dpu_utils/tfmodels30% | 43% | 16% | 6% | 2%
dotnet/CSharpSourceGraphExtraction/Utils0% | 23% | 29% | 25% | 22%
dotnet/CSharpSourceGraphExtraction/GraphBuilders0% | 11% | 18% | 26% | 43%
dotnet/Utils0% | 6% | 44% | 15% | 32%
python/dpu_utils/utils0% | 6% | 7% | 34% | 51%
dotnet/CSharpSourceGraphExtraction0% | 0% | 44% | 26% | 28%
python/dpu_utils/tfutils0% | 0% | 32% | 48% | 19%
python/dpu_utils/mlutils0% | 0% | 12% | 33% | 54%
python/dpu_utils/tf2utils0% | 0% | 26% | 45% | 27%
python/dpu_utils/codeutils0% | 0% | 9% | 31% | 59%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in python/dpu_utils/ptutils/componenttrainer.py
129 26 12
def async_ggnn_layer()
in python/dpu_utils/tfmodels/asyncgnn.py
103 10 8
def sparse_gnn_layer()
in python/dpu_utils/tfmodels/sparsegnn.py
95 20 8
public static void AddDataFlowEdges()
in dotnet/CSharpSourceGraphExtraction/GraphBuilders/DataFlowGraphBuilder.cs
76 23 4
public static()
in dotnet/CSharpSourceGraphExtraction/Utils/MethodUtils.cs
57 13 3
def __init__()
in python/dpu_utils/tfmodels/sparsegnn.py
55 11 3
public AzurePath()
in dotnet/Utils/RichPath.cs
52 7 2
public void Add()
in dotnet/CSharpSourceGraphExtraction/Utils/TypeHierarchy.cs
51 15 1
def create()
in python/dpu_utils/utils/richpath.py
51 12 2
public override()
in dotnet/CSharpSourceGraphExtraction/GraphBuilders/VariableUseGraphBuilder.cs
41 7 2
private LocalPath CacheFileLocally()
in dotnet/Utils/RichPath.cs
38 6 0
public override void VisitInvocationExpression()
in dotnet/CSharpSourceGraphExtraction/MethodUseInformationCollector.cs
37 8 1
public void WriteJson()
in dotnet/Utils/DirectedGraph.cs
35 6 3
private string GetNodeType()
in dotnet/CSharpSourceGraphExtraction/SourceGraph.cs
33 7 1
public static IEnumerable GetAvailableValueSymbols()
in dotnet/CSharpSourceGraphExtraction/Utils/RoslynUtils.cs
33 8 2
public void WriteElement()
in dotnet/Utils/ChunkedJsonWriter.cs
33 6 1
public override()
in dotnet/CSharpSourceGraphExtraction/GraphBuilders/VariableUseGraphBuilder.cs
31 6 2
def __cache_file_locally()
in python/dpu_utils/utils/richpath.py
31 10 2
public override void Store()
in dotnet/Utils/RichPath.cs
30 4 1
public override void Store()
in dotnet/Utils/RichPath.cs
30 4 1