microsoft / opensource-management-portal
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,056 units with 29,009 lines of code in units (53.1% of code).
    • 22 very long units (3,476 lines of code)
    • 59 long units (3,946 lines of code)
    • 275 medium size units (8,505 lines of code)
    • 460 small units (6,764 lines of code)
    • 1,240 very small units (6,318 lines of code)
11% | 13% | 29% | 23% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts11% | 13% | 29% | 23% | 21%
js54% | 0% | 20% | 12% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
jobs31% | 23% | 19% | 16% | 8%
api35% | 18% | 19% | 19% | 6%
routes20% | 9% | 39% | 19% | 11%
middleware18% | 7% | 45% | 18% | 10%
features24% | 30% | 18% | 14% | 11%
default-assets-package100% | 0% | 0% | 0% | 0%
business2% | 9% | 31% | 31% | 25%
lib0% | 10% | 33% | 28% | 27%
webhooks0% | 47% | 34% | 10% | 7%
scripts0% | 75% | 0% | 9% | 14%
user0% | 19% | 17% | 21% | 41%
entities0% | 6% | 6% | 12% | 74%
ROOT0% | 0% | 14% | 45% | 40%
config0% | 0% | 49% | 31% | 19%
github0% | 0% | 23% | 39% | 37%
interfaces0% | 0% | 0% | 41% | 58%
views0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
268 79 7
async lockdownIfNecessary()
in features/newRepositoryLockdown.ts
235 63 4
232 30 6
module.exports = function()
in default-assets-package/Gruntfile.js
204 2 1
async function refreshOrganization()
in jobs/refreshQueryCache/task.ts
181 29 5
176 45 1
async function processRepository()
in jobs/reports/repositories.ts
164 56 2
162 46 3
async function sendEmail()
in api/createRepo.ts
162 51 12
export async function sendTerminatedAccountMail()
in business/operations/unlinkMail.ts
156 39 5
export default function SiteErrorHandler()
in middleware/errorHandler.ts
149 85 4
async function processTeam()
in jobs/reports/teams.ts
143 44 2
async function initializeAsync()
in middleware/initialize.ts
138 23 4
137 38 5
async function getOrganizationData()
in jobs/reports/organizations.ts
136 33 1
async function processDeletedRepositories()
in jobs/refreshQueryCache/deletedRepositories.ts
133 27 1
async function basicTeamsView()
in routes/org/team/index.ts
130 23 2
reasons: transformReasonsToArray()
in jobs/reports/repositories.ts
122 61 2
async function refresh()
in jobs/refreshUsernames/index.ts
121 21 1
export default asyncHandler()
in routes/reposPager.ts
116 29 3