microsoft / satcheljs-cookbook
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 7 units with 89 lines of code in units (20.7% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 1 medium size units (25 lines of code)
    • 4 small units (55 lines of code)
    • 2 very small units (9 lines of code)
0% | 0% | 28% | 61% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx0% | 0% | 43% | 56% | 0%
ts0% | 0% | 0% | 71% | 28%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/components0% | 0% | 43% | 56% | 0%
src/mutators0% | 0% | 0% | 100% | 0%
src/services0% | 0% | 0% | 0% | 100%
src/selectors0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 7 longest units
Unit# linesMcCabe index# params
export default observer()
in src/components/Cart.tsx
25 1 1
export default observer()
in src/components/App.tsx
19 1 1
export default observer()
in src/components/Description.tsx
13 5 1
function findBookInCart()
in src/mutators/cart/books.ts
12 3 1
function findFirstBookId()
in src/mutators/selectedBookId.ts
11 3 1
export default function makePurchase()
in src/services/makePurchase.ts
5 1 1
export default function getSelectedBookId()
in src/selectors/getSelectedBookId.ts
4 2 0