awslabs / aws-lambda-powertools-python
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 983 units with 3,529 lines of code in units (52.5% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 0 medium complex units (0 lines of code)
    • 13 simple units (230 lines of code)
    • 970 very simple units (3,299 lines of code)
0% | 0% | 0% | 6% | 93%
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
py0% | 0% | 0% | 6% | 93%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
aws_lambda_powertools/utilities0% | 0% | 0% | 5% | 94%
aws_lambda_powertools/logging0% | 0% | 0% | 13% | 86%
aws_lambda_powertools/middleware_factory0% | 0% | 0% | 100% | 0%
aws_lambda_powertools/event_handler0% | 0% | 0% | 9% | 90%
aws_lambda_powertools/tracing0% | 0% | 0% | 0% | 100%
aws_lambda_powertools/metrics0% | 0% | 0% | 0% | 100%
aws_lambda_powertools/shared0% | 0% | 0% | 0% | 100%
benchmark/src0% | 0% | 0% | 0% | 100%
aws_lambda_powertools0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def formatTime()
in aws_lambda_powertools/logging/formatter.py
18 10 3
def evaluate()
in aws_lambda_powertools/utilities/feature_flags/feature_flags.py
28 9 6
def _extract_log_keys()
in aws_lambda_powertools/logging/formatter.py
12 9 2
def validate_feature()
in aws_lambda_powertools/utilities/feature_flags/schema.py
8 8 2
def _route()
in aws_lambda_powertools/event_handler/api_gateway.py
9 8 3
def get_enabled_features()
in aws_lambda_powertools/utilities/feature_flags/feature_flags.py
29 7 4
def _get_idempotency_record()
in aws_lambda_powertools/utilities/idempotency/base.py
13 7 1
def lambda_handler_decorator()
in aws_lambda_powertools/middleware_factory/factory.py
30 6 2
def parse()
in aws_lambda_powertools/utilities/parser/parser.py
14 6 4
def configure()
in aws_lambda_powertools/utilities/idempotency/persistence/base.py
20 6 3
def _add_route()
in aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py
14 6 5
def _get_statement_for_effect()
in aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py
18 6 3
def register_resolver()
in aws_lambda_powertools/event_handler/api_gateway.py
17 6 1
def transform_value()
in aws_lambda_powertools/utilities/parameters/base.py
12 5 3
def _get_multiple()
in aws_lambda_powertools/utilities/parameters/ssm.py
13 5 5
def _clean()
in aws_lambda_powertools/utilities/batch/sqs.py
19 5 1
def _process_idempotency()
in aws_lambda_powertools/utilities/idempotency/base.py
11 5 1
def _handle_for_status()
in aws_lambda_powertools/utilities/idempotency/base.py
9 5 2
def _formatted_time()
in aws_lambda_powertools/utilities/data_classes/appsync/scalar_types_utils.py
13 5 3
def asdict()
in aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py
14 5 1