aws-samples / bank-transfer-blockchain-reinvent2019-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 52 units with 796 lines of code in units (37.5% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 2 medium complex units (155 lines of code)
    • 3 simple units (87 lines of code)
    • 47 very simple units (554 lines of code)
0% | 0% | 19% | 10% | 69%
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
go0% | 0% | 34% | 13% | 52%
py0% | 0% | 0% | 14% | 85%
js0% | 0% | 0% | 0% | 100%
ts0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
solution0% | 0% | 83% | 0% | 16%
chaincode/src/bank0% | 0% | 35% | 7% | 57%
chaincode/src/interbank0% | 0% | 0% | 47% | 52%
setup0% | 0% | 0% | 14% | 85%
ui/src/app0% | 0% | 0% | 0% | 100%
chaincode/src/forex0% | 0% | 0% | 0% | 100%
events0% | 0% | 0% | 0% | 100%
api0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func()
in solution/transfer.go
86 17 1
func()
in chaincode/src/bank/transfer.go
69 14 1
func()
in chaincode/src/interbank/interbank.go
46 8 1
func()
in chaincode/src/bank/bank.go
15 6 1
def obtain_admin_cert()
in setup/setup_fabric_environment.py
26 6 0
func()
in chaincode/src/bank/bank.go
23 5 1
func()
in chaincode/src/bank/deposit.go
23 5 1
func()
in chaincode/src/bank/accounts.go
16 4 1
func getCurrencyConversion()
in chaincode/src/bank/transfer.go
17 4 4
func()
in chaincode/src/bank/history.go
18 4 1
func()
in chaincode/src/forex/forex.go
19 4 1
func getCurrencyConversion()
in solution/transfer.go
17 4 4
def runCommand()
in setup/setup_fabric_environment.py
15 4 1
def waitTillVPCEndpointIsReady()
in setup/setup_fabric_environment.py
13 4 2
async function getClientForOrg()
in events/connection.js
19 3 2
21 3 2
func()
in chaincode/src/bank/accounts.go
10 3 1
func()
in chaincode/src/forex/forex.go
9 3 1
func()
in chaincode/src/forex/forex.go
13 3 1
func()
in chaincode/src/interbank/interbank.go
9 3 1