aws-samples / aws-serverless-security-workshop
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 31 units with 559 lines of code in units (50.9% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 2 medium complex units (194 lines of code)
    • 5 simple units (186 lines of code)
    • 24 very simple units (179 lines of code)
0% | 0% | 34% | 33% | 32%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
js0% | 0% | 34% | 33% | 32%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/authorizer0% | 0% | 47% | 33% | 18%
src/app0% | 0% | 26% | 32% | 40%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
exports.lambda_handler = function()
in src/app/customizeUnicorn.js
90 14 3
function ValidateToken()
in src/authorizer/index.js
104 13 4
exports.lambda_handler = function()
in src/app/unicornParts.js
48 7 3
function AuthPolicy()
in src/authorizer/index.js
23 7 3
var addMethod = function()
in src/authorizer/index.js
30 7 4
var getStatementsForEffect = function()
in src/authorizer/index.js
21 7 2
exports.lambda_handler = function()
in src/app/managePartners.js
64 6 3
deleteCustomUnicorn: function()
in src/app/dbUtils.js
14 5 2
build: function()
in src/authorizer/index.js
15 5 0
listCustomUnicorn: function()
in src/app/dbUtils.js
9 4 1
getCustomUnicorn: function()
in src/app/dbUtils.js
8 4 2
query()
in src/app/dbUtils.js
17 3 3
close()
in src/app/dbUtils.js
9 2 1
6 1 1
6 1 1
6 1 1
6 1 1
6 1 1
connectToDb()
in src/app/dbUtils.js
5 1 1
getDbConfig()
in src/app/dbUtils.js
12 1 0