microsoft / ailab
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,800 units with 34,255 lines of code in units (47.3% of code).
    • 12 very long units (1,724 lines of code)
    • 56 long units (3,607 lines of code)
    • 337 medium size units (10,164 lines of code)
    • 598 small units (8,725 lines of code)
    • 1,797 very small units (10,035 lines of code)
5% | 10% | 29% | 25% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js10% | 10% | 30% | 22% | 26%
cs1% | 10% | 30% | 26% | 31%
cpp83% | 0% | 0% | 0% | 16%
py3% | 14% | 26% | 29% | 25%
tsx0% | 12% | 28% | 30% | 27%
ts0% | 0% | 0% | 29% | 70%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sketch2Code/Sketch2Code.Web11% | 10% | 31% | 21% | 25%
VirtualStage/KinectMaskGenerator83% | 0% | 0% | 0% | 16%
GoogleAssistantConnector/DemoBot46% | 20% | 9% | 13% | 10%
BuildAnIntelligentBot/src4% | 6% | 33% | 25% | 31%
Snip-Insights/SnipInsight1% | 9% | 29% | 26% | 32%
VirtualStage/BackgroundMatting16% | 19% | 13% | 26% | 24%
VirtualStage/Speaker.Recorder0% | 17% | 29% | 24% | 28%
Pix2Story/source0% | 13% | 33% | 28% | 23%
JFKFiles/JfkWebApiSkills0% | 28% | 19% | 38% | 13%
Snip-Insights/SnipInsight.Forms0% | 7% | 10% | 34% | 47%
GoogleAssistantConnector/GoogleAssistant0% | 9% | 23% | 27% | 39%
JFKFiles/frontend0% | 9% | 22% | 30% | 37%
Snip-Insights/SnipInsight.Forms.GTK0% | 2% | 42% | 28% | 26%
Sketch2Code/Sketch2Code.AI0% | 32% | 15% | 0% | 52%
Sketch2Code/Sketch2Code.Core0% | 0% | 53% | 31% | 15%
JFKFiles/resources0% | 0% | 80% | 16% | 3%
Sketch2Code/Sketch2Code.Api0% | 0% | 100% | 0% | 0%
MachineTeaching/Smart-Building0% | 0% | 0% | 72% | 27%
MachineTeaching/Machine-Calibration0% | 0% | 0% | 56% | 44%
MachineTeaching/Motion-Control0% | 0% | 0% | 48% | 51%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
270 78 0
int main()
in VirtualStage/KinectMaskGenerator/main.cpp
204 26 2
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
173 63 0
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
164 54 0
private static HeroCard GetHeroCard()
in GoogleAssistantConnector/DemoBot/BotUsingCards/CardsBot.cs
157 1 0
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
113 40 0
exports.AttachmentView = function()
in BuildAnIntelligentBot/src/ChatBot/wwwroot/built/Attachment.js
111 43 1
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
110 28 0
public async Task DeleteAsync()
in Snip-Insights/SnipInsight/AppManager.cs
110 22 3
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
105 22 0
function()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
104 28 0
def get_parser()
in VirtualStage/BackgroundMatting/app_parser.py
103 6 0
def trainer()
in Pix2Story/source/skipthoughts_vectors/training/train.py
98 13 2
def trainer()
in Pix2Story/source/skipthoughts_vectors/decoding/train.py
97 12 4
(function (global, factory)()
in Sketch2Code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
97 15 2
static compact()
in GoogleAssistantConnector/GoogleAssistant/DirectLineToActionsOnGoogleLib/lib/googleActions/RichMessageLimitationsManager.js
88 28 2
buildPages()
in JFKFiles/frontend/src/common/components/pagination/pagination.tsx
86 6 0
(function (global, factory)()
in Sketch2Code/Sketch2Code.Web/Scripts/umd/popper.js
84 10 2
private unsafe BitmapSource GetBitmapFromImage()
in VirtualStage/Speaker.Recorder/Speaker.Recorder/Kinect/DecodedKinectCaptureFrame.cs
83 10 0
private void RenderThread()
in VirtualStage/Speaker.Recorder/Speaker.Recorder/Kinect/KinectCaptureProvider.cs
79 22 1