microsoft / accessibility-insights-web
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,604 units with 17,985 lines of code in units (28.2% of code).
    • 9 very long units (1,960 lines of code)
    • 15 long units (1,018 lines of code)
    • 149 medium size units (4,316 lines of code)
    • 342 small units (5,009 lines of code)
    • 1,089 very small units (5,682 lines of code)
10% | 5% | 23% | 27% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts9% | 4% | 20% | 28% | 36%
js72% | 0% | 15% | 5% | 6%
tsx0% | 10% | 33% | 31% | 25%
nsh0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT94% | 0% | 0% | 0% | 5%
src/background18% | 3% | 20% | 27% | 29%
src/injected11% | 5% | 22% | 26% | 34%
src/electron12% | 12% | 11% | 29% | 34%
deploy100% | 0% | 0% | 0% | 0%
src/common0% | 10% | 13% | 22% | 53%
src/DetailsView0% | 7% | 30% | 38% | 24%
src/assessments0% | 11% | 28% | 30% | 29%
src/reports0% | 0% | 51% | 28% | 20%
src/scanner0% | 0% | 32% | 34% | 32%
tools/strict-null-checks0% | 0% | 65% | 23% | 11%
src/popup0% | 0% | 38% | 39% | 22%
src/views0% | 0% | 27% | 39% | 33%
src/issue-filing0% | 0% | 28% | 25% | 45%
src/debug-tools0% | 0% | 28% | 25% | 45%
src/Devtools0% | 0% | 0% | 86% | 13%
src/content0% | 0% | 0% | 35% | 64%
src/fast-pass0% | 0% | 0% | 40% | 59%
src/report-export0% | 0% | 0% | 0% | 100%
src/ad-hoc-visualizations0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
768 20 1
public async initialize()
in src/injected/main-window-initializer.ts
271 1 0
constructor()
in src/electron/platform/android/rule-information-provider.ts
190 3 0
async function initialize()
in src/background/background-init.ts
140 1 0
public createTabContext()
in src/background/tab-context-factory.ts
132 1 1
public async initialize()
in src/injected/window-initializer.ts
128 1 0
public static async createContext()
in src/background/global-context-factory.ts
113 1 12
module.exports = function()
in deploy/Gruntfile.js
112 12 1
public registerCallbacks()
in src/background/actions/assessment-action-creator.ts
106 1 0
public registerCallbacks()
in src/background/actions/action-creator.ts
98 1 0
private recommend()
in src/common/components/recommend-color.tsx
94 8 3
export function getAllFeatureFlagDetails()
in src/common/feature-flags.ts
83 1 0
public render()
in src/electron/views/results/results-view.tsx
77 1 0
export function initializeFabricIcons()
in src/common/fabric-icons.ts
76 1 0
private getCenterPositionRelativeToAreaShape()
in src/injected/visualization/center-position-calculator.ts
69 9 6
private getAssessmentSchemaBase()
in src/DetailsView/components/load-assessment-data-validator.ts
65 1 0
public static Manual()
in src/assessments/assessment-builder.tsx
63 3 1
public render()
in src/electron/views/device-connect-view/components/android-setup/prompt-choose-device-step.tsx
63 3 0
export function getReportExportDialogForFastPass()
in src/DetailsView/components/report-export-dialog-factory.tsx
60 2 1
public static Assisted()
in src/assessments/assessment-builder.tsx
60 5 1