aws-samples / aws-serverless-security-workshop
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 31 units with 559 lines of code in units (50.9% of code).
    • 1 very long units (104 lines of code)
    • 2 long units (154 lines of code)
    • 4 medium size units (122 lines of code)
    • 5 small units (71 lines of code)
    • 19 very small units (108 lines of code)
18% | 27% | 21% | 12% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js18% | 27% | 21% | 12% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/authorizer47% | 0% | 33% | 6% | 11%
src/app0% | 45% | 14% | 16% | 24%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function ValidateToken()
in src/authorizer/index.js
104 13 4
exports.lambda_handler = function()
in src/app/customizeUnicorn.js
90 14 3
exports.lambda_handler = function()
in src/app/managePartners.js
64 6 3
exports.lambda_handler = function()
in src/app/unicornParts.js
48 7 3
var addMethod = function()
in src/authorizer/index.js
30 7 4
function AuthPolicy()
in src/authorizer/index.js
23 7 3
var getStatementsForEffect = function()
in src/authorizer/index.js
21 7 2
query()
in src/app/dbUtils.js
17 3 3
build: function()
in src/authorizer/index.js
15 5 0
deleteCustomUnicorn: function()
in src/app/dbUtils.js
14 5 2
createCustomUnicorn: function()
in src/app/dbUtils.js
13 1 7
getDbConfig()
in src/app/dbUtils.js
12 1 0
addPartnerCompany: function()
in src/app/dbUtils.js
10 1 1
close()
in src/app/dbUtils.js
9 2 1
listCustomUnicorn: function()
in src/app/dbUtils.js
9 4 1
getCustomUnicorn: function()
in src/app/dbUtils.js
8 4 2
var getEmptyStatement = function()
in src/authorizer/index.js
8 1 1
6 1 1
6 1 1
6 1 1