awslabs / aws-waf-security-automations
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 92 units with 2,757 lines of code in units (93.2% of code).
    • 1 very complex units (210 lines of code)
    • 3 complex units (294 lines of code)
    • 8 medium complex units (716 lines of code)
    • 16 simple units (568 lines of code)
    • 64 very simple units (969 lines of code)
7% | 10% | 25% | 20% | 35%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py7% | 10% | 25% | 20% | 35%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
custom_resource41% | 0% | 0% | 36% | 22%
log_parser0% | 21% | 33% | 16% | 27%
helper0% | 37% | 38% | 6% | 16%
reputation_lists_parser0% | 0% | 45% | 34% | 19%
access_handler0% | 0% | 65% | 34% | 0%
ip_retention_handler0% | 0% | 20% | 0% | 80%
timer0% | 0% | 0% | 54% | 45%
lib0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def lambda_handler()
in source/custom_resource/custom-resource.py
210 64 2
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 merge_outstanding_requesters()
in source/log_parser/log-parser.py
115 29 6
def send_anonymous_usage_data()
in source/log_parser/log-parser.py
240 24 1
def update_ip_set()
in source/log_parser/log-parser.py
59 20 3
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 check_app_log_bucket()
in source/helper/helper.py
29 13 3
def check_service_dependencies()
in source/helper/helper.py
40 13 2
def lambda_handler()
in source/ip_retention_handler/remove_expired_ip.py
40 13 2
def lambda_handler()
in source/log_parser/log-parser.py
54 12 2
def add_s3_bucket_lambda_event()
in source/custom_resource/custom-resource.py
44 10 6
def lambda_handler()
in source/log_parser/add_athena_partitions.py
36 10 2
def remove_s3_bucket_lambda_event()
in source/custom_resource/custom-resource.py
31 9 4
def lambda_handler()
in source/reputation_lists_parser/reputation-lists.py
60 8 2
def check_requirements()
in source/helper/helper.py
12 8 2
def lambda_handler()
in source/access_handler/access-handler.py
64 8 2
def lambda_handler()
in source/log_parser/partition_s3_logs.py
40 8 2
def process_athena_scheduler_event()
in source/log_parser/log-parser.py
9 8 2