awslabs / aws-cloudfront-extensions
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 153 units with 6,414 lines of code in units (60.8% of code).
    • 5 very long units (3,109 lines of code)
    • 12 long units (809 lines of code)
    • 50 medium size units (1,682 lines of code)
    • 35 small units (546 lines of code)
    • 51 very small units (268 lines of code)
48% | 12% | 26% | 8% | 4%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts98% | 0% | 1% | 0% | 0%
py13% | 19% | 45% | 14% | 7%
js0% | 52% | 20% | 19% | 6%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
templates/aws-cloudfront-waf61% | 7% | 20% | 8% | 2%
templates/aws-cloudfront-monitoring45% | 20% | 26% | 6% | 2%
edge/nodejs0% | 52% | 20% | 19% | 6%
edge/python0% | 0% | 42% | 33% | 24%
scripts/python0% | 0% | 63% | 8% | 27%
util/update-auth-cognito-function0% | 0% | 89% | 0% | 10%
util/update-lambda-function0% | 0% | 88% | 0% | 11%
templates/workshop-demo0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in templates/aws-cloudfront-waf/lib/aws-cloudfront-waf-main.ts
1647 2 3
constructor()
in templates/aws-cloudfront-monitoring/source/templates/lib/aws-cloudfront-monitoring-stack.ts
1002 1 3
def lambda_handler()
in templates/aws-cloudfront-waf/source/custom_resource/custom-resource.py
206 64 2
def send_anonymous_usage_data()
in templates/aws-cloudfront-waf/source/reputation_lists_parser/reputation-lists.py
130 14 2
def send_anonymous_usage_data()
in templates/aws-cloudfront-waf/source/access_handler/access-handler.py
124 14 6
def gen_detailed_by_interval()
in templates/aws-cloudfront-monitoring/source/lambda.d/metric_collector_download_speed_cdn/metric_collector_download_speed_cdn.py
97 12 4
def gen_detailed_by_interval()
in templates/aws-cloudfront-monitoring/source/lambda.d/metric_collector_download_speed_origin/metric_collector_download_speed_origin.py
96 12 4
def construct_query_string()
in templates/aws-cloudfront-monitoring/source/lambda.d/shared_lib/python/metric_helper.py
82 9 6
def lambda_handler()
in templates/aws-cloudfront-waf/source/helper/helper.py
67 29 2
async function getOriginalResponse()
in edge/nodejs/custom-response-with-replaced-url/custom-response-with-replaced-url/app.js
67 4 4
def lambda_handler()
in templates/aws-cloudfront-monitoring/source/lambda.d/add_partition/add_partition.py
65 4 2
def lambda_handler()
in templates/aws-cloudfront-waf/source/access_handler/access-handler.py
61 7 2
def lambda_handler()
in templates/aws-cloudfront-waf/source/reputation_lists_parser/reputation-lists.py
60 8 2
def lambda_handler()
in templates/aws-cloudfront-monitoring/source/lambda.d/metric_collector_status_code_origin/metric_collector_status_code_origin.py
55 7 2
function getResponse()
in edge/nodejs/multiple-origin-IP-retry/multiple-origin-IP-retry/app.js
54 4 1
def lambda_handler()
in templates/aws-cloudfront-monitoring/source/lambda.d/metric_collector_status_code_cdn/metric_collector_status_code_cdn.py
53 8 2
def build_athena_query_part_two_for_partition()
in templates/aws-cloudfront-waf/source/log_parser/build_athena_queries.py
52 6 3
def handler()
in util/update-auth-cognito-function/index.py
50 4 2
def lambda_handler()
in edge/python/rt_log_transformer/rt_log_transformer/app.py
49 8 2
def lambda_handler()
in templates/aws-cloudfront-monitoring/source/lambda.d/metric_collector_chr_bandwidth/metric_collector_chr_bandwidth.py
47 5 2