microsoft / Mobius
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 2,032 units with 20,059 lines of code in units (66.7% of code).
    • 0 very long units (0 lines of code)
    • 26 long units (1,738 lines of code)
    • 176 medium size units (5,291 lines of code)
    • 342 small units (5,034 lines of code)
    • 1,488 very small units (7,996 lines of code)
0% | 8% | 26% | 25% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs0% | 6% | 25% | 24% | 43%
scala0% | 16% | 35% | 27% | 20%
cpp0% | 41% | 16% | 42% | 0%
py0% | 0% | 0% | 74% | 25%
h0% | 0% | 0% | 0% | 100%
java0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scala/src0% | 17% | 36% | 25% | 20%
csharp/AdapterTest0% | 6% | 30% | 33% | 29%
csharp/Worker0% | 39% | 36% | 17% | 6%
csharp/Adapter0% | 3% | 16% | 18% | 61%
cpp/Riosock0% | 39% | 15% | 39% | 6%
csharp/Repl0% | 21% | 11% | 45% | 20%
csharp/WorkerTest0% | 6% | 75% | 9% | 7%
csharp/ReplTest0% | 0% | 59% | 0% | 40%
csharp/Tests.Common0% | 0% | 50% | 22% | 27%
scala/perf0% | 0% | 21% | 63% | 15%
csharp/Perf0% | 0% | 24% | 47% | 27%
python/perf0% | 0% | 0% | 74% | 25%
csharp/Utils0% | 0% | 0% | 38% | 61%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private IEnumerable GetIterator()
in csharp/Worker/Microsoft.Spark.CSharp/UDFCommand.cs
100 17 3
public void TestDStreamJoin()
in csharp/AdapterTest/DStreamTest.cs
89 47 0
private void SocketTest()
in csharp/AdapterTest/SocketWrapperTest.cs
87 6 1
def main()
in scala/src/main/org/apache/spark/deploy/csharp/CSharpRunner.scala
83 12 1
private def printUsageAndExit()
in scala/src/main/org/apache/spark/launcher/SparkCLRSubmitArguments.scala
79 10 1
public void TestInitialize()
in csharp/AdapterTest/TestWithMoqDemo.cs
77 5 0
private void ProcessCallbackRequest()
in csharp/Adapter/Microsoft.Spark.CSharp/Proxy/Ipc/StreamingContextIpcProxy.cs
76 11 1
def handleMethodCall()
in scala/src/main/org/apache/spark/api/csharp/CSharpBackendHandler.scala
75 14 6
HRESULT RIOSOCKAPI RIOSockInitialize()
in cpp/Riosock/Riosock.cpp
71 8 0
def writeObject()
in scala/src/main/org/apache/spark/api/csharp/SerDe.scala
67 21 2
HRESULT EnsureWinSockMethods()
in cpp/Riosock/Riosock.cpp
65 9 1
public void Run()
in csharp/Worker/Microsoft.Spark.CSharp/TaskRunner.cs
65 8 0
private object ReadCollection()
in csharp/Adapter/Microsoft.Spark.CSharp/Interop/Ipc/JvmBridge.cs
64 13 1
public ScriptResult Execute()
in csharp/Repl/RoslynScriptEngine.cs
64 10 1
def handleBackendRequest()
in scala/src/main/org/apache/spark/api/csharp/CSharpBackendHandler.scala
63 13 1
public static bool ProcessStream()
in csharp/Worker/Microsoft.Spark.CSharp/Worker.cs
60 5 3
SOCKET RIOSOCKAPI CreateRIOSocket()
in cpp/Riosock/Riosock.cpp
59 6 2
private def unzip()
in scala/src/main/org/apache/spark/api/csharp/CSharpRDD.scala
57 15 1
private object CallJavaMethod()
in csharp/Adapter/Microsoft.Spark.CSharp/Interop/Ipc/JvmBridge.cs
56 10 4
internal static extern IntPtr CreateRIORequestQueue()
in csharp/Adapter/Microsoft.Spark.CSharp/Network/RioNative.cs
56 1 4