aws-samples / bank-transfer-blockchain-reinvent2019-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 52 units with 796 lines of code in units (37.5% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (155 lines of code)
    • 9 medium size units (266 lines of code)
    • 16 small units (248 lines of code)
    • 25 very small units (127 lines of code)
0% | 19% | 33% | 31% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 34% | 20% | 31% | 14%
py0% | 0% | 68% | 25% | 6%
js0% | 0% | 56% | 22% | 20%
ts0% | 0% | 0% | 56% | 44%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
solution0% | 83% | 0% | 16% | 0%
chaincode/src/bank0% | 35% | 23% | 33% | 8%
setup0% | 0% | 68% | 25% | 6%
chaincode/src/interbank0% | 0% | 47% | 27% | 25%
events0% | 0% | 54% | 37% | 7%
api0% | 0% | 60% | 0% | 40%
ui/src/app0% | 0% | 0% | 56% | 44%
chaincode/src/forex0% | 0% | 0% | 57% | 42%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in solution/transfer.go
86 17 1
func()
in chaincode/src/bank/transfer.go
69 14 1
def setup_vpc_endpoint()
in setup/setup_fabric_environment.py
49 2 0
func()
in chaincode/src/interbank/interbank.go
46 8 1
async function main()
in events/listener.js
28 2 0
def create_export_file()
in setup/setup_fabric_environment.py
26 1 0
def obtain_admin_cert()
in setup/setup_fabric_environment.py
26 6 0
def store_public_certs()
in setup/setup_fabric_environment.py
24 3 0
func()
in chaincode/src/bank/bank.go
23 5 1
func()
in chaincode/src/bank/deposit.go
23 5 1
21 3 2
async function getClientForOrg()
in events/connection.js
19 3 2
func()
in chaincode/src/forex/forex.go
19 4 1
func()
in chaincode/src/bank/history.go
18 4 1
def update_vpc_security_group()
in setup/setup_fabric_environment.py
18 3 1
func getCurrencyConversion()
in chaincode/src/bank/transfer.go
17 4 4
func getCurrencyConversion()
in solution/transfer.go
17 4 4
func()
in chaincode/src/bank/accounts.go
16 4 1
func()
in chaincode/src/bank/bank.go
15 6 1
submit()
in ui/src/app/transfer/transfer.component.ts
15 1 0