bazelbuild / rules_nodejs
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 544 units with 8,360 lines of code in units (33.7% of code).
    • 3 very long units (347 lines of code)
    • 26 long units (1,810 lines of code)
    • 88 medium size units (2,606 lines of code)
    • 144 small units (2,104 lines of code)
    • 283 very small units (1,493 lines of code)
4% | 21% | 31% | 25% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js7% | 20% | 31% | 27% | 13%
ts2% | 22% | 30% | 23% | 20%
go0% | 16% | 40% | 20% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/create63% | 0% | 0% | 22% | 14%
internal/node24% | 0% | 45% | 24% | 5%
packages/concatjs3% | 21% | 30% | 20% | 23%
internal/npm_install0% | 21% | 38% | 23% | 15%
internal/linker0% | 35% | 24% | 23% | 16%
internal/coverage0% | 95% | 0% | 0% | 4%
internal/pkg_npm0% | 53% | 0% | 29% | 16%
packages/jasmine0% | 74% | 0% | 16% | 8%
packages/typescript0% | 27% | 21% | 27% | 23%
packages/rollup0% | 50% | 0% | 27% | 21%
packages/terser0% | 28% | 40% | 25% | 5%
packages/esbuild0% | 54% | 26% | 11% | 8%
packages/worker0% | 0% | 48% | 22% | 28%
internal/runfiles0% | 0% | 57% | 18% | 24%
packages/node-patches0% | 0% | 48% | 48% | 2%
scripts0% | 0% | 20% | 56% | 23%
packages/runfiles0% | 0% | 40% | 38% | 21%
internal/generated_file_test0% | 0% | 76% | 23% | 0%
internal/pkg_web0% | 0% | 27% | 62% | 9%
packages/protractor0% | 0% | 0% | 100% | 0%
packages/cypress0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function main()
in packages/create/index.js
127 12 3
function()
in internal/node/require_patch.js
116 25 4
export async function createProgramAndEmit()
in packages/concatjs/internal/tsc_wrapped/tsc_wrapped.ts
104 19 5
function printPackageLegacy()
in internal/npm_install/generate_build_file.ts
99 17 1
export function filterExpected()
in packages/concatjs/internal/tsc_wrapped/diagnostics.ts
99 15 3
function main()
in internal/linker/index.js
90 21 2
function printPackageLegacy()
in internal/npm_install/index.js
90 17 1
export async function main()
in internal/linker/link_node_modules.ts
85 21 2
function main()
in internal/pkg_npm/packager.js
79 17 1
async function main()
in packages/jasmine/jasmine_runner.js
76 16 1
function linkModules()
in internal/linker/index.js
75 27 2
async function generatePackageBuildFiles()
in internal/npm_install/index.js
74 25 1
func main()
in packages/concatjs/devserver/main.go
73 15 0
export function emitWithTsickle()
in packages/concatjs/internal/tsc_wrapped/tsc_wrapped.ts
73 14 6
async function generatePackageBuildFiles()
in internal/npm_install/generate_build_file.ts
69 23 1
async function linkModules()
in internal/linker/link_node_modules.ts
68 27 2
function main()
in packages/typescript/internal/ts_project_options_validator.ts
64 7 4
disableStrictDeps: isUndefined()
in packages/concatjs/internal/tsc_wrapped/tsconfig.ts
64 24 1
async function generateBazelWorkspace()
in internal/npm_install/generate_build_file.ts
63 10 2
suppressTsconfigOverrideWarnings: isUndefined()
in packages/concatjs/internal/tsc_wrapped/tsconfig.ts
61 23 1