microsoft / PTVS
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 7,988 units with 89,401 lines of code in units (59.2% of code).
    • 26 very long units (3,702 lines of code)
    • 171 long units (11,340 lines of code)
    • 885 medium size units (26,928 lines of code)
    • 1,443 small units (20,821 lines of code)
    • 5,463 very small units (26,610 lines of code)
4% | 12% | 30% | 23% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs3% | 12% | 29% | 23% | 30%
cpp20% | 24% | 33% | 10% | 10%
py3% | 10% | 31% | 23% | 30%
js0% | 26% | 59% | 0% | 13%
h0% | 0% | 26% | 0% | 73%
c0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Python/Product3% | 13% | 29% | 23% | 29%
Common/Product4% | 9% | 31% | 23% | 30%
Common/Tools40% | 30% | 20% | 3% | 4%
Python/Templates0% | 22% | 50% | 4% | 22%
Build/17.00% | 0% | 49% | 40% | 10%
Build/16.00% | 0% | 56% | 21% | 22%
Python/Setup0% | 0% | 66% | 0% | 33%
Build0% | 0% | 0% | 0% | 100%
Python/Prerequisites0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
bool DoAttach()
in Python/Product/PyDebugAttach/PyDebugAttach.cpp
328 101 3
internal int AddItemWithSpecificInternal()
in Common/Product/SharedProject/ProjectNode.cs
248 68 12
private void InitializeComponent()
in Python/Product/PythonTools/PythonTools/WebProject/PythonWebLauncherOptions.Designer.cs
236 1 0
public SnapshotSpan? GetExpressionRange()
in Python/Product/PythonTools/PythonTools/Intellisense/ReverseExpressionParser.cs
187 83 6
public void WriteLog()
in Python/Product/PythonTools/PythonTools/DiagnosticsProvider.cs
182 22 2
public virtual object GetProperty()
in Common/Product/SharedProject/HierarchyNode.cs
168 56 1
private Addition CanAddFileFromProjectReference()
in Common/Product/SharedProject/ProjectNode.CopyPaste.cs
165 38 3
def _selftest()
in Python/Product/PythonTools/ptvsd/util.py
138 23 1
public bool Execute()
in Python/Product/BuildTasks/ResolveEnvironment.cs
133 25 0
public int Exec()
in Python/Product/PythonTools/PythonTools/Intellisense/IntellisenseController.cs
131 70 5
public TaskDialogButton ShowModal()
in Common/Product/SharedProject/TaskDialog.cs
125 25 0
private bool GenerateOutput()
in Common/Tools/BuildTasks/ExtractLambdasFromXaml.cs
125 13 0
public TaskDialogButton ShowModal()
in Python/Product/VSCommon/Infrastructure/TaskDialog.cs
125 26 0
def main()
in Python/Product/TestAdapter/visualstudio_py_testlauncher.py
121 6 0
private bool DiscoverInterpreters()
in Python/Product/VSInterpreters/Interpreter/MSBuildProjectInterpreterFactoryProvider.cs
118 21 1
private void InitializeComponent()
in Python/Product/PythonTools/PythonTools/Options/PythonDebuggingOptionsControl.Designer.cs
113 1 0
public static async Task ShowDialogAsync()
in Python/Product/PythonTools/PythonTools/Environments/AddEnvironmentDialog.xaml.cs
112 16 8
internal virtual bool IsUpToDate()
in Common/Product/SharedProject/ProjectConfig.cs
111 22 0
private void InitializeComponent()
in Python/Product/PythonTools/PythonTools/Project/DefaultPythonLauncherOptions.Designer.cs
111 1 0
public void diff_cleanupMerge()
in Python/Product/PythonTools/PythonTools/Editor/Formatting/DiffMatchPatch.cs
108 23 1