firebase / firebase-tools
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,749 units with 30,168 lines of code in units (61.1% of code).
    • 21 very long units (3,745 lines of code)
    • 55 long units (3,531 lines of code)
    • 381 medium size units (11,558 lines of code)
    • 447 small units (6,608 lines of code)
    • 845 very small units (4,726 lines of code)
12% | 11% | 38% | 21% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts13% | 11% | 37% | 22% | 15%
js4% | 12% | 47% | 19% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/emulator18% | 17% | 33% | 15% | 14%
src/extensions11% | 5% | 41% | 26% | 15%
scripts/storage-emulator-integration47% | 0% | 35% | 6% | 10%
scripts34% | 0% | 28% | 21% | 15%
src/commands27% | 0% | 39% | 13% | 19%
src/deploy5% | 16% | 40% | 24% | 11%
src3% | 11% | 39% | 24% | 21%
src/firestore19% | 9% | 29% | 28% | 12%
src/hosting18% | 11% | 34% | 26% | 8%
src/init8% | 14% | 53% | 12% | 11%
src/gcp0% | 10% | 28% | 39% | 20%
src/management0% | 0% | 57% | 34% | 7%
standalone0% | 0% | 70% | 24% | 4%
src/functions0% | 0% | 47% | 39% | 12%
src/database0% | 0% | 46% | 23% | 29%
src/serve0% | 0% | 67% | 0% | 32%
src/appdistribution0% | 0% | 45% | 28% | 25%
src/remoteconfig0% | 0% | 59% | 40% | 0%
src/throttler0% | 0% | 22% | 28% | 49%
scripts/integration-helpers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export function createFirebaseEndpoints()
in src/emulator/storage/apis/firebase.ts
401 59 1
describe()
in scripts/storage-emulator-integration/tests.ts
330 14 2
export async function startAll()
in src/emulator/controller.ts
330 45 2
function addEmulatorOperations()
in scripts/gen-auth-api-spec.ts
329 1 1
export function registerHandlers()
in src/emulator/auth/handlers.ts
231 37 3
export function createCloudEndpoints()
in src/emulator/storage/apis/gcloud.ts
206 27 1
function batchCreate()
in src/emulator/auth/operations.ts
169 45 2
async function installExtension()
in src/commands/ext-install.ts
152 31 1
module.exports = function()
in src/commands/index.js
143 6 1
function signInWithIdp()
in src/emulator/auth/operations.ts
141 29 2
function parseEndpoints()
in src/deploy/functions/runtimes/discovery/v1alpha1.ts
139 17 5
133 33 1
async loadTriggers()
in src/emulator/functionsEmulator.ts
132 21 2
124 21 1
private recursiveBatchDelete()
in src/firestore/delete.ts
120 26 0
export async function createApp()
in src/emulator/auth/server.ts
117 15 2
116 17 1
export function validateSpec()
in src/extensions/extensionsHelper.ts
112 47 1
export async function prepare()
in src/deploy/functions/prepare.ts
111 11 3
105 35 2