aws-samples / aws-utility-meter-data-analytics-platform-cn
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 53 units with 709 lines of code in units (12.2% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (126 lines of code)
    • 7 medium size units (221 lines of code)
    • 10 small units (151 lines of code)
    • 34 very small units (211 lines of code)
0% | 17% | 31% | 21% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 17% | 31% | 21% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
assets/functions/prepare_training0% | 76% | 0% | 0% | 23%
assets/functions/prepare_batch0% | 70% | 0% | 0% | 29%
assets/functions/meter_forecast0% | 0% | 53% | 23% | 23%
assets/functions/get_anomaly0% | 0% | 100% | 0% | 0%
assets/functions/upload_result0% | 0% | 83% | 0% | 16%
assets/functions/batch_anomaly_detection0% | 0% | 34% | 57% | 8%
assets/functions/check_initial_pipeline_run0% | 0% | 66% | 0% | 33%
assets/functions/redshift0% | 0% | 44% | 33% | 21%
assets/functions/split_batch0% | 0% | 100% | 0% | 0%
assets/glue/scripts0% | 0% | 0% | 35% | 64%
assets/functions/state_topic_subscription0% | 0% | 0% | 58% | 41%
assets/functions/crawler0% | 0% | 0% | 64% | 35%
assets/functions/load_pipeline_parameter0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def lambda_handler()
in assets/functions/prepare_training/app.py
73 9 2
def lambda_handler()
in assets/functions/prepare_batch/app.py
53 5 2
def lambda_handler()
in assets/functions/get_anomaly/app.py
44 7 2
def lambda_handler()
in assets/functions/meter_forecast/app.py
44 5 2
def lambda_handler()
in assets/functions/upload_result/app.py
31 3 2
def process_batch()
in assets/functions/batch_anomaly_detection/app.py
26 4 5
def lambda_handler()
in assets/functions/check_initial_pipeline_run/app.py
26 2 2
def lambda_handler()
in assets/functions/redshift/consumption/app.py
25 4 2
def lambda_handler()
in assets/functions/split_batch/app.py
25 1 2
def fit_predict_model()
in assets/functions/batch_anomaly_detection/app.py
20 1 2
def load_redshift_cred()
in assets/functions/redshift/consumption/app.py
19 4 0
def encode_request()
in assets/functions/meter_forecast/app.py
19 4 2
def aggregate_and_write_data_to_s3()
in assets/glue/scripts/business_aggregate_monthly.py
15 1 2
def aggregate_and_write_data_to_s3()
in assets/glue/scripts/business_aggregate_weekly.py
15 1 2
def aggregate_and_write_data_to_s3()
in assets/glue/scripts/business_aggregate_daily.py
15 1 2
def trigger_state_machine()
in assets/functions/state_topic_subscription/app.py
14 2 0
def get_batch_data()
in assets/functions/batch_anomaly_detection/app.py
12 1 5
def lambda_handler()
in assets/functions/batch_anomaly_detection/app.py
11 1 2
def lambda_handler()
in assets/functions/crawler/trigger_glue_crawler/app.py
11 2 2
def lambda_handler()
in assets/functions/state_topic_subscription/app.py
10 3 2