aws-samples / aws-serverless-books-api-sample
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 205 lines of code in units (38.5% of code).
    • 1 very long units (135 lines of code)
    • 0 long units (0 lines of code)
    • 1 medium size units (33 lines of code)
    • 1 small units (17 lines of code)
    • 4 very small units (20 lines of code)
65% | 0% | 16% | 8% | 9%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts65% | 0% | 16% | 8% | 9%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pipeline/lib100% | 0% | 0% | 0% | 0%
src/books/create0% | 0% | 100% | 0% | 0%
src/books/get-all0% | 0% | 0% | 54% | 45%
src/books/create-pre-traffic0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 7 longest units
Unit# linesMcCabe index# params
constructor()
in pipeline/lib/pipeline-stack.ts
135 1 3
async function handler()
in src/books/create/index.ts
33 3 1
async function handler()
in src/books/get-all/index.ts
17 3 0
year: parseInt()
in src/books/get-all/index.ts
7 1 2
function wait()
in src/books/create-pre-traffic/index.ts
6 2 1
rating: parseInt()
in src/books/get-all/index.ts
4 1 2
pages: parseInt()
in src/books/get-all/index.ts
3 1 2