awslabs / aws-waf-security-automations
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 92 units with 2,757 lines of code in units (93.2% of code).
    • 6 very long units (931 lines of code)
    • 6 long units (356 lines of code)
    • 28 medium size units (896 lines of code)
    • 29 small units (439 lines of code)
    • 23 very small units (135 lines of code)
33% | 12% | 32% | 15% | 4%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py33% | 12% | 32% | 15% | 4%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
log_parser44% | 15% | 25% | 12% | 2%
custom_resource41% | 0% | 48% | 8% | 1%
reputation_lists_parser45% | 21% | 18% | 12% | 1%
access_handler65% | 34% | 0% | 0% | 0%
helper0% | 37% | 55% | 6% | 0%
ip_retention_handler0% | 0% | 54% | 22% | 23%
timer0% | 0% | 100% | 0% | 0%
lib0% | 0% | 20% | 60% | 18%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def send_anonymous_usage_data()
in source/log_parser/log-parser.py
240 24 1
def lambda_handler()
in source/custom_resource/custom-resource.py
210 64 2
def send_anonymous_usage_data()
in source/reputation_lists_parser/reputation-lists.py
130 14 2
def send_anonymous_usage_data()
in source/access_handler/access-handler.py
124 14 6
def merge_outstanding_requesters()
in source/log_parser/log-parser.py
115 29 6
def get_outstanding_requesters()
in source/log_parser/log-parser.py
112 32 4
def lambda_handler()
in source/helper/helper.py
67 29 2
def lambda_handler()
in source/access_handler/access-handler.py
64 8 2
def lambda_handler()
in source/reputation_lists_parser/reputation-lists.py
60 8 2
def update_ip_set()
in source/log_parser/log-parser.py
59 20 3
def lambda_handler()
in source/log_parser/log-parser.py
54 12 2
def build_athena_query_part_two_for_partition()
in source/log_parser/build_athena_queries.py
52 6 3
def configure_s3_bucket()
in source/custom_resource/custom-resource.py
45 7 4
def add_s3_bucket_lambda_event()
in source/custom_resource/custom-resource.py
44 10 6
def check_service_dependencies()
in source/helper/helper.py
40 13 2
def lambda_handler()
in source/log_parser/partition_s3_logs.py
40 8 2
def lambda_handler()
in source/ip_retention_handler/remove_expired_ip.py
40 13 2
def execute_athena_query()
in source/log_parser/log-parser.py
37 6 3
def lambda_handler()
in source/timer/timer.py
36 6 2
def build_athena_query_for_app_access_logs()
in source/log_parser/build_athena_queries.py
36 2 7