awslabs / aws-lambda-powertools-python
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 983 units with 3,529 lines of code in units (52.5% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 6 medium size units (162 lines of code)
    • 47 small units (675 lines of code)
    • 930 very small units (2,692 lines of code)
0% | 0% | 4% | 19% | 76%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 4% | 19% | 76%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
aws_lambda_powertools/utilities0% | 0% | 4% | 14% | 81%
aws_lambda_powertools/middleware_factory0% | 0% | 100% | 0% | 0%
aws_lambda_powertools/tracing0% | 0% | 12% | 28% | 59%
aws_lambda_powertools/event_handler0% | 0% | 0% | 36% | 63%
aws_lambda_powertools/logging0% | 0% | 0% | 30% | 69%
aws_lambda_powertools/metrics0% | 0% | 0% | 49% | 50%
aws_lambda_powertools/shared0% | 0% | 0% | 0% | 100%
benchmark/src0% | 0% | 0% | 0% | 100%
aws_lambda_powertools0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def lambda_handler_decorator()
in aws_lambda_powertools/middleware_factory/factory.py
30 6 2
def get_enabled_features()
in aws_lambda_powertools/utilities/feature_flags/feature_flags.py
29 7 4
def evaluate()
in aws_lambda_powertools/utilities/feature_flags/feature_flags.py
28 9 6
def decorate()
in aws_lambda_powertools/tracing/tracer.py
26 4 3
def _match_by_action()
in aws_lambda_powertools/utilities/feature_flags/feature_flags.py
25 3 4
def _update_record()
in aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py
24 2 2
def configure()
in aws_lambda_powertools/utilities/idempotency/persistence/base.py
20 6 3
def _put_record()
in aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py
20 3 2
def _not_found()
in aws_lambda_powertools/event_handler/api_gateway.py
20 4 2
def _clean()
in aws_lambda_powertools/utilities/batch/sqs.py
19 5 1
def _get_function_response()
in aws_lambda_powertools/utilities/idempotency/base.py
19 4 1
def decorate()
in aws_lambda_powertools/tracing/tracer.py
18 2 2
def get_raw_configuration()
in aws_lambda_powertools/utilities/feature_flags/appconfig.py
18 4 1
def validate_data_against_schema()
in aws_lambda_powertools/utilities/validation/base.py
18 4 4
def decorate()
in aws_lambda_powertools/utilities/idempotency/idempotency.py
18 3 2
def _get_statement_for_effect()
in aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py
18 6 3
def formatTime()
in aws_lambda_powertools/logging/formatter.py
18 10 3
def register_resolver()
in aws_lambda_powertools/event_handler/api_gateway.py
17 6 1
def _call_route()
in aws_lambda_powertools/event_handler/api_gateway.py
17 4 4
def decorate()
in aws_lambda_powertools/tracing/tracer.py
16 2 2