awslabs / aws-cloudformation-templates
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 146 units with 2,614 lines of code in units (11.5% of code).
    • 1 very long units (135 lines of code)
    • 1 long units (84 lines of code)
    • 46 medium size units (1,342 lines of code)
    • 50 small units (746 lines of code)
    • 48 very small units (307 lines of code)
5% | 3% | 51% | 28% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 3% | 50% | 28% | 10%
js0% | 0% | 53% | 29% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
aws/solutions/StackSetsResource21% | 13% | 45% | 14% | 5%
aws/solutions/lambda-backed-cloudformation-custom-resources0% | 0% | 55% | 35% | 9%
aws/services/CloudFormation0% | 0% | 56% | 35% | 8%
community/solutions/StaticWebSiteWithPipeline0% | 0% | 53% | 29% | 17%
aws/solutions/PrefixListResource0% | 0% | 49% | 31% | 18%
community/custom_resources/python_custom_resource_helper0% | 0% | 71% | 23% | 4%
aws/solutions/Fetch-AMI-From-Parameter-Store0% | 0% | 100% | 0% | 0%
aws/solutions/DirectoryServiceSettings0% | 0% | 0% | 37% | 62%
aws/solutions/ADConnector0% | 0% | 0% | 42% | 57%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def update()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
135 27 2
def create()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
84 14 2
def delete()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
49 13 2
def create_stacks()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
48 9 6
def update_stacks()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
48 9 6
def delete_stacks()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
45 9 5
def handler()
in aws/services/CloudFormation/MacrosExamples/S3Objects/lambda/resource.py
44 9 2
def handle_template()
in aws/services/CloudFormation/MacrosExamples/S3Objects/lambda/macro.py
39 11 2
def expand_role()
in aws/services/CloudFormation/MacrosExamples/ExecutionRoleBuilder/lambda/index.py
39 14 1
def update_stack_set()
in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py
36 8 8
function sendResponse()
in community/solutions/StaticWebSiteWithPipeline/lambdas/getHostedZoneName.js
35 2 5
function sendResponse()
in community/solutions/StaticWebSiteWithPipeline/lambdas/requestCertificate.js
35 2 5
function sendResponse()
in community/solutions/StaticWebSiteWithPipeline/lambdas/clearBuckets.js
35 2 5
function sendResponse()
in community/solutions/StaticWebSiteWithPipeline/lambdas/approveCertificate.js
34 1 5
def send()
in aws/solutions/StackSetsResource/FunctionCode/crhelper.py
31 8 7
def cloudformation_create()
in aws/solutions/lambda-backed-cloudformation-custom-resources/update_kms_policy/lambda_function.py
31 6 2
def send()
in aws/solutions/PrefixListResource/FunctionCode/crhelper.py
31 8 7
def send()
in community/custom_resources/python_custom_resource_helper/crhelper.py
31 8 7
def cloudformation_create()
in aws/solutions/lambda-backed-cloudformation-custom-resources/get_latest_ami_id/lambda_function.py
30 11 2
def log()
in aws/services/CloudFormation/MacrosExamples/StackMetrics/lambda/resource.py
29 2 3