microsoft / WhatTheHack
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 1,912 units with 21,910 lines of code in units (22.4% of code).
    • 15 very long units (2,266 lines of code)
    • 30 long units (1,924 lines of code)
    • 173 medium size units (5,173 lines of code)
    • 384 small units (5,645 lines of code)
    • 1,310 very small units (6,902 lines of code)
10% | 8% | 23% | 25% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js20% | 10% | 19% | 20% | 29%
cs3% | 6% | 26% | 29% | 33%
py25% | 10% | 24% | 24% | 15%
scala0% | 45% | 15% | 18% | 20%
csx0% | 0% | 76% | 0% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
009-MicroservicesInAzure21% | 10% | 17% | 17% | 33%
006-AppModernization25% | 0% | 23% | 26% | 25%
001-IntroToKubernetes9% | 5% | 16% | 23% | 44%
039-AKSEnterpriseGrade26% | 10% | 25% | 25% | 11%
016-AppMigration9% | 5% | 38% | 20% | 25%
002-IntroToAzureAI0% | 10% | 23% | 35% | 30%
003-DrivingMissData0% | 40% | 24% | 16% | 19%
021-IdentityForApps0% | 21% | 34% | 20% | 22%
017-FrontDoor0% | 24% | 46% | 11% | 17%
005-RockPaperScissorsBoom0% | 9% | 22% | 35% | 31%
044-DevOpswithGithubActions0% | 9% | 19% | 28% | 41%
015-Serverless0% | 0% | 66% | 16% | 16%
047-TrafficControlWithDapr0% | 0% | 34% | 27% | 38%
030-ConversationalAI0% | 0% | 26% | 38% | 35%
027-FHIRPoweredHealthcare0% | 0% | 25% | 51% | 22%
031-DevOpsWithGitHub0% | 0% | 16% | 24% | 58%
010-AzureDevOps0% | 0% | 33% | 17% | 49%
014-OSSDevOps0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
protected override void Seed()
in 006-AppModernization/Student/Resources/OnPremApp/IaaS2PaaSWeb/PartsUnlimitedWebsite/Utils/PartsUnlimitedDbInitializer.cs
292 1 1
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
272 78 0
public override void Up()
in 006-AppModernization/Student/Resources/OnPremApp/IaaS2PaaSWeb/PartsUnlimitedWebsite/Migrations/201503130633247_InitialMigration.cs
205 1 1
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
178 66 0
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
165 56 0
def send_sql_query()
in 039-AKSEnterpriseGrade/Student/Resources/api/sql_api.py
135 45 7
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
128 40 0
(function (factory)()
in 001-IntroToKubernetes/Student/Resources/Challenge 1/content-web/public/js/knockout.validation.js
122 7 1
(function (factory)()
in 001-IntroToKubernetes/Student/Resources/Challenge 7/content-web-v2/public/js/knockout.validation.js
122 7 1
113 62 1
var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName()
in 006-AppModernization/Student/Resources/OnPremApp/IaaS2PaaSWeb/PartsUnlimitedWebsite/Scripts/respond.matchmedia.addListener.js
113 62 1
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
111 28 0
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
106 28 0
function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
103 22 0
render()
in 016-AppMigration/Student/Resources/src/frontend/src/ProductDetails.js
101 7 0
(function ()()
in 044-DevOpswithGithubActions/Student/Resources/src/Contoso.Web/wwwroot/lib/ko/knockout.validation.debug.js
98 2 1
(function (global, factory)()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
97 15 2
def GetSchemaHomogenizedDataframe()
in 003-DrivingMissData/Coach/Solutions/Challenge02/06-LoadData-Green.scala
84 9 3
var Tooltip = function()
in 009-MicroservicesInAzure/Coach/Solutions/Code/Host.MVC.Core/wwwroot/lib/bootstrap/js/bootstrap.bundle.js
75 1 1
public static async Task CreateUserWithCustomAttribute()
in 021-IdentityForApps/Student/Resources/MSGraphApp/src/Services/UserService.cs
75 6 3