aws-samples / non-profit-blockchain
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 214 units with 2,995 lines of code in units (21.7% of code).
    • 4 very long units (687 lines of code)
    • 3 long units (174 lines of code)
    • 22 medium size units (595 lines of code)
    • 43 small units (665 lines of code)
    • 142 very small units (874 lines of code)
22% | 5% | 19% | 22% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js32% | 8% | 15% | 19% | 24%
ts0% | 0% | 31% | 28% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ngo-identity/chaincode33% | 10% | 10% | 18% | 27%
ngo-events/chaincode35% | 10% | 10% | 14% | 28%
ngo-chaincode/src36% | 11% | 9% | 15% | 27%
ngo-lambda/src43% | 0% | 26% | 20% | 9%
ngo-ui/src0% | 0% | 31% | 28% | 40%
ngo-rest-api0% | 0% | 54% | 24% | 21%
ngo-events/listener0% | 0% | 20% | 62% | 16%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
async function allocateSpend()
in ngo-identity/chaincode/src/ngo.js
186 38 2
async function allocateSpend()
in ngo-events/chaincode/src/ngo.js
186 38 2
async function allocateSpend()
in ngo-chaincode/src/ngo.js
186 38 2
async function invokeChaincode()
in ngo-lambda/src/invoke.js
129 15 1
async function queryByString()
in ngo-identity/chaincode/src/ngo.js
58 14 2
async function queryByString()
in ngo-events/chaincode/src/ngo.js
58 14 2
async function queryByString()
in ngo-chaincode/src/ngo.js
58 14 2
async function dummySpend()
in ngo-rest-api/app.js
45 4 0
async createDonation()
in ngo-identity/chaincode/src/ngo.js
35 5 2
signup()
in ngo-ui/src/app/ui/signup/signup.component.ts
35 4 0
async createDonation()
in ngo-events/chaincode/src/ngo.js
35 5 2
async function handler()
in ngo-lambda/src/index.js
31 9 3
populate()
in ngo-ui/src/app/services/shared/donor.service.ts
29 7 0
async createDonation()
in ngo-chaincode/src/ngo.js
28 5 2
getNGOFundsDetails()
in ngo-ui/src/app/ui/ngos-list/ngos-list.component.ts
27 6 1
getNGOFundsDetails()
in ngo-ui/src/app/ui/ngo-details/ngo-details.component.ts
27 6 1
login()
in ngo-ui/src/app/ui/signin/signin.component.ts
25 3 0
async function queryChaincode()
in ngo-lambda/src/query.js
25 4 1
ngOnInit()
in ngo-ui/src/app/ui/ngos-list/ngos-list.component.ts
24 2 0
ngoJsonAdopter()
in ngo-ui/src/app/services/ngo.service.ts
24 4 1