microsoft / rushstack
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,968 units with 46,334 lines of code in units (61.1% of code).
    • 37 very long units (5,445 lines of code)
    • 122 long units (8,216 lines of code)
    • 462 medium size units (14,677 lines of code)
    • 635 small units (9,295 lines of code)
    • 1,712 very small units (8,701 lines of code)
11% | 17% | 31% | 20% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts11% | 18% | 31% | 20% | 18%
js43% | 0% | 28% | 21% | 6%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
apps/rush-lib11% | 18% | 31% | 20% | 17%
apps/api-extractor19% | 20% | 32% | 16% | 11%
apps/api-documenter14% | 22% | 32% | 12% | 18%
eslint/eslint-config91% | 0% | 8% | 0% | 0%
apps/heft6% | 21% | 32% | 23% | 16%
libraries/heft-config-file45% | 0% | 28% | 15% | 9%
libraries/node-core-library5% | 14% | 30% | 22% | 28%
heft-plugins/heft-jest-plugin12% | 27% | 28% | 20% | 11%
heft-plugins/heft-webpack5-plugin45% | 0% | 28% | 25% | 0%
heft-plugins/heft-webpack4-plugin50% | 0% | 31% | 17% | 0%
repo-scripts/repo-toolbox64% | 0% | 0% | 10% | 25%
libraries/rushell23% | 0% | 10% | 32% | 34%
libraries/debug-certificate-manager0% | 44% | 33% | 8% | 13%
apps/api-extractor-model0% | 12% | 16% | 14% | 57%
eslint/eslint-plugin-packlets0% | 50% | 37% | 0% | 12%
libraries/ts-command-line0% | 12% | 38% | 14% | 34%
libraries/tree-pattern0% | 80% | 0% | 0% | 19%
rush-plugins/rush-amazon-s3-build-cache-plugin0% | 17% | 36% | 26% | 20%
heft-plugins/heft-storybook-plugin0% | 46% | 31% | 14% | 7%
libraries/package-deps-hash0% | 14% | 33% | 49% | 2%
common/scripts0% | 0% | 47% | 41% | 11%
rush-plugins/rush-azure-storage-build-cache-plugin0% | 0% | 60% | 32% | 6%
libraries/terminal0% | 0% | 38% | 25% | 35%
libraries/typings-generator0% | 0% | 63% | 21% | 14%
libraries/rig-package0% | 0% | 60% | 30% | 9%
apps/rundown0% | 0% | 54% | 12% | 32%
heft-plugins/heft-sass-plugin0% | 0% | 61% | 25% | 12%
libraries/load-themed-styles0% | 0% | 49% | 12% | 38%
apps/rush0% | 0% | 49% | 16% | 34%
rush-plugins/rush-litewatch-plugin0% | 0% | 21% | 49% | 29%
eslint/eslint-plugin0% | 0% | 25% | 65% | 9%
libraries/stream-collator0% | 0% | 24% | 31% | 44%
heft-plugins/heft-dev-cert-plugin0% | 0% | 42% | 30% | 27%
repo-scripts/doc-plugin-rush-stack0% | 0% | 0% | 93% | 6%
eslint/eslint-patch0% | 0% | 0% | 42% | 57%
repo-scripts/tombstone0% | 0% | 0% | 0% | 100%
libraries/rush-sdk0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function buildRules()
in eslint/eslint-config/profile/_common.js
330 2 1
public static prepare()
in apps/api-extractor/src/api/ExtractorConfig.ts
296 56 1
private constructor()
in apps/rush-lib/src/api/RushConfiguration.ts
199 40 2
public async prepareCommonTempAsync()
in apps/rush-lib/src/logic/installManager/RushInstallManager.ts
197 42 1
private async _executeTaskAsync()
in apps/rush-lib/src/logic/taskExecution/ProjectTaskRunner.ts
195 32 1
public static invoke()
in apps/api-extractor/src/api/Extractor.ts
194 22 2
private _writeApiItemPage()
in apps/api-documenter/src/documenters/MarkdownDocumenter.ts
186 47 1
private async _loadConfigurationFileInnerAsync()
in libraries/heft-config-file/src/ConfigurationFile.ts
177 33 4
private _linkProject()
in apps/rush-lib/src/logic/npm/NpmLinkManager.ts
171 23 3
private async _getNormalizedVersionSpec()
in apps/rush-lib/src/logic/PackageJsonUpdater.ts
169 39 6
private _serializeFormattableTextSegments()
in libraries/node-core-library/src/Terminal/Terminal.ts
169 34 1
public static generateReviewFileContent()
in apps/api-extractor/src/generators/ApiReportGenerator.ts
143 30 1
private static _modifySpan()
in apps/api-extractor/src/generators/DtsRollupGenerator.ts
142 38 5
protected async prepareCommonTempAsync()
in apps/rush-lib/src/logic/installManager/WorkspaceInstallManager.ts
138 24 1
private _calculateApiItemMetadata()
in apps/api-extractor/src/collector/Collector.ts
136 31 1
protected onDefineParameters()
in apps/rush-lib/src/cli/actions/PublishAction.ts
136 8 0
protected async runAsync()
in apps/rush-lib/src/cli/actions/ScanAction.ts
133 30 0
public apply()
in heft-plugins/heft-jest-plugin/src/JestPlugin.ts
133 1 3
protected async installAsync()
in apps/rush-lib/src/logic/installManager/RushInstallManager.ts
131 18 1
private static _modifySpan()
in apps/api-extractor/src/generators/ApiReportGenerator.ts
130 34 5