aws-samples / amazon-lookout-for-metrics-samples
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 81 units with 1,527 lines of code in units (59.6% of code).
    • 3 very long units (475 lines of code)
    • 5 long units (313 lines of code)
    • 10 medium size units (299 lines of code)
    • 16 small units (244 lines of code)
    • 47 very small units (196 lines of code)
31% | 20% | 19% | 15% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py26% | 14% | 23% | 19% | 15%
ts53% | 45% | 0% | 0% | 1%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
workshops/RI2021/ml_ops/lambdas63% | 0% | 19% | 9% | 7%
getting_started27% | 24% | 13% | 22% | 11%
next_steps/kinesis_stream_connector/l4m_connector/stack97% | 0% | 0% | 0% | 2%
next_steps/kinesis_stream_connector/l4m_detector/stack0% | 100% | 0% | 0% | 0%
next_steps/kinesis_stream_connector/data_generator/stack0% | 100% | 0% | 0% | 0%
next_steps/readable_alerts_html0% | 35% | 40% | 16% | 7%
next_steps/kinesis_stream_connector/data_generator/src0% | 0% | 51% | 24% | 23%
next_steps/kinesis_stream_connector/l4m_detector/src0% | 0% | 51% | 24% | 23%
next_steps/readable_alerts0% | 0% | 0% | 60% | 40%
workshops/RI2021/ml_ops/shared0% | 0% | 0% | 0% | 100%
next_steps/kinesis_stream_connector/l4m_connector/src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def lambda_handler()
in workshops/RI2021/ml_ops/lambdas/anomaly-alert-function/anomaly-alert-function.py
181 40 2
def crawlerRoleCreation()
in getting_started/utility.py
149 5 1
constructor()
in next_steps/kinesis_stream_connector/l4m_connector/stack/l4m_connector_stack.ts
145 1 3
def lambda_role()
in getting_started/utility.py
73 5 2
constructor()
in next_steps/kinesis_stream_connector/l4m_detector/stack/l4m_detector_stack.ts
70 1 3
def L4M_role()
in getting_started/utility.py
61 5 1
constructor()
in next_steps/kinesis_stream_connector/data_generator/stack/data_generator_stack.ts
55 1 3
def lookup_anomaly_group_and_get_details()
in next_steps/readable_alerts_html/readable_alerts_html.py
54 17 3
def create_email_contents()
in next_steps/readable_alerts_html/readable_alerts_html.py
38 7 6
def get_or_create_iam_role()
in getting_started/utility.py
37 2 1
def synthesize()
in getting_started/synth_data.py
36 13 0
def synthesize()
in next_steps/kinesis_stream_connector/data_generator/src/synth_live_data_csv.py
32 14 0
def synthesize()
in next_steps/kinesis_stream_connector/l4m_detector/src/synth_live_data_csv.py
32 14 0
def lambda_handler()
in workshops/RI2021/ml_ops/lambdas/attach-alert-function/attach-alert-function.py
29 1 2
def lambda_handler()
in workshops/RI2021/ml_ops/lambdas/create-and-activate-detector/create-and-activate-detector.py
26 1 2
def write_to_kinesis()
in next_steps/kinesis_stream_connector/data_generator/src/synth_live_data_csv.py
23 6 2
def write_to_kinesis()
in next_steps/kinesis_stream_connector/l4m_detector/src/synth_live_data_csv.py
23 6 2
def send_email()
in next_steps/readable_alerts_html/readable_alerts_html.py
23 1 2
def wait_delete_anomaly_detector()
in getting_started/utility.py
20 6 2
def make_tree()
in getting_started/utility.py
20 6 5