microsoft / lsif-node
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 893 units with 8,442 lines of code in units (70.4% of code).
    • 4 very long units (603 lines of code)
    • 15 long units (990 lines of code)
    • 64 medium size units (1,994 lines of code)
    • 121 small units (1,700 lines of code)
    • 689 very small units (3,155 lines of code)
7% | 11% | 23% | 20% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts7% | 11% | 23% | 20% | 37%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tsc/src8% | 8% | 25% | 22% | 35%
tooling/src41% | 0% | 29% | 25% | 3%
sqlite/src6% | 18% | 28% | 12% | 33%
npm/src0% | 31% | 27% | 23% | 17%
tsc/src/common0% | 11% | 19% | 19% | 49%
lsif/src0% | 68% | 0% | 0% | 31%
tsc/src/npm0% | 0% | 22% | 33% | 44%
protocol/src0% | 0% | 0% | 13% | 86%
tsc/src/emitters0% | 0% | 0% | 85% | 15%
npm/src/common0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export async function run()
in tsc/src/main.ts
198 54 2
163 47 7
private validateEdge()
in tooling/src/validate.ts
128 45 1
public compress()
in sqlite/src/compress.ts
114 32 3
export async function run()
in npm/src/main.ts
87 25 1
protected visit()
in tsc/src/lsif.ts
82 26 1
public insert()
in sqlite/src/blobStore.ts
81 27 1
export function builder()
in tsc/src/args.ts
81 3 1
protected walkType()
in tsc/src/lsif.ts
79 32 6
async run()
in sqlite/src/store.ts
67 13 0
private addReferencedData()
in sqlite/src/blobStore.ts
65 19 2
private computeHash()
in sqlite/src/blobStore.ts
64 18 0
public item()
in tsc/src/common/graph.ts
62 14 4
constructor()
in tsc/src/lsif.ts
57 6 7
contents: value as()
in tsc/src/common/graph.ts
55 9 1
export async function main()
in lsif/src/main.ts
53 5 0
public documentProcessed()
in tsc/src/lsif.ts
53 14 1
public handleMoniker()
in npm/src/main.ts
52 17 1
private handleDocumentEnd()
in sqlite/src/blobStore.ts
52 18 1
export function builder()
in sqlite/src/args.ts
50 1 1