aws-samples / sessions-with-aws-sam
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 37 units with 445 lines of code in units (7.1% of code).
    • 1 very long units (136 lines of code)
    • 0 long units (0 lines of code)
    • 2 medium size units (45 lines of code)
    • 9 small units (142 lines of code)
    • 25 very small units (122 lines of code)
30% | 0% | 10% | 31% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts100% | 0% | 0% | 0% | 0%
js0% | 0% | 16% | 38% | 44%
go0% | 0% | 0% | 86% | 13%
cs0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sam-or-cdk100% | 0% | 0% | 0% | 0%
s12d0% | 0% | 22% | 33% | 44%
governance0% | 0% | 0% | 46% | 53%
go-al20% | 0% | 0% | 86% | 13%
dotnet-api0% | 0% | 0% | 100% | 0%
appconfig-lambda-extensions0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in sam-or-cdk/cdk/lib/signedurl-stack.ts
136 1 3
CREATE_LINK: async()
in s12d/client/src/store/links.js
23 3 3
FETCH_DATA: async()
in s12d/client/src/store/links.js
22 4 2
func handler()
in go-al2/hello-world/main.go
20 5 1
UPDATE_LINK: async()
in s12d/client/src/store/links.js
20 2 3
public async Task FunctionHandler()
in dotnet-api/src/SaveUser/Function.cs
18 2 1
DELETE_LINK: async()
in s12d/client/src/store/links.js
18 3 2
EXCHANGE_TOKEN: async()
in s12d/client/src/store/auth.js
15 2 1
REFRESH_TOKEN: async()
in s12d/client/src/store/auth.js
14 1 1
async function getConfigurationItem()
in governance/3-custom-rules/src/generic-by-params.js
13 3 1
function convertApiConfiguration()
in governance/3-custom-rules/src/generic-by-params.js
13 3 1
async function getConfig()
in appconfig-lambda-extensions/src/app.js
11 2 0
async function getConfiguration()
in governance/3-custom-rules/src/generic-by-params.js
9 1 3
id: nanoid()
in s12d/client/src/store/links.js
9 3 1
LOGOUT: async()
in s12d/client/src/store/auth.js
9 1 1
function evaluateCompliance()
in governance/3-custom-rules/src/generic-by-params.js
8 3 2
function convertJSON()
in s12d/client/src/store/auth.js
8 1 1
FETCHING_ERROR()
in s12d/client/src/store/links.js
6 2 2
FETCHING_SUCCESS()
in s12d/client/src/store/links.js
6 3 2
function isApplicable()
in governance/3-custom-rules/src/generic-by-params.js
5 3 2