aws / aws-sam-cli
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 1,865 units with 14,802 lines of code in units (57.0% of code).
    • 1 very long units (123 lines of code)
    • 10 long units (656 lines of code)
    • 130 medium size units (3,768 lines of code)
    • 298 small units (4,282 lines of code)
    • 1,426 very small units (5,973 lines of code)
<1% | 4% | 25% | 28% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py<1% | 4% | 25% | 28% | 40%
java0% | 0% | 0% | 37% | 62%
go0% | 0% | 0% | 86% | 13%
cs0% | 0% | 0% | 68% | 31%
rb0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
samcli/local/docker18% | 7% | 12% | 35% | 25%
samcli/commands/deploy0% | 22% | 25% | 28% | 23%
samcli/lib/bootstrap0% | 20% | 21% | 16% | 41%
samcli/commands/build0% | 25% | 24% | 26% | 24%
samcli/local/apigw0% | 17% | 32% | 19% | 30%
samcli/commands/local0% | 6% | 48% | 22% | 21%
samcli/lib/iac0% | 11% | 0% | 11% | 77%
samcli/lib/cli_validation0% | 77% | 0% | 22% | 0%
samcli/commands/pipeline0% | 12% | 33% | 27% | 26%
samcli/lib/intrinsic_resolver0% | 0% | 49% | 26% | 24%
samcli/lib/package0% | 0% | 35% | 24% | 39%
samcli/lib/build0% | 0% | 29% | 33% | 37%
samcli/lib/sync0% | 0% | 22% | 21% | 56%
samcli/cli0% | 0% | 30% | 31% | 37%
samcli/commands/_utils0% | 0% | 20% | 28% | 51%
samcli/commands/delete0% | 0% | 55% | 34% | 10%
samcli/lib/providers0% | 0% | 15% | 18% | 66%
samcli/lib/utils0% | 0% | 14% | 21% | 64%
samcli/lib/deploy0% | 0% | 41% | 42% | 16%
samcli/lib/samlib0% | 0% | 49% | 28% | 22%
samcli/lib/pipeline0% | 0% | 41% | 23% | 34%
samcli/lib/telemetry0% | 0% | 33% | 21% | 45%
samcli/lib/schemas0% | 0% | 24% | 59% | 16%
samcli/lib/observability0% | 0% | 14% | 23% | 62%
samcli/local/lambdafn0% | 0% | 17% | 44% | 37%
samcli/lib/cookiecutter0% | 0% | 27% | 15% | 57%
samcli/commands/validate0% | 0% | 43% | 24% | 31%
samcli/local/lambda_service0% | 0% | 37% | 9% | 52%
samcli/commands/sync0% | 0% | 73% | 0% | 26%
samcli/local/events0% | 0% | 25% | 68% | 6%
samcli/commands/init0% | 0% | 10% | 57% | 31%
samcli/commands/package0% | 0% | 18% | 57% | 24%
samcli/commands/publish0% | 0% | 62% | 0% | 37%
samcli/lib/docker0% | 0% | 53% | 30% | 15%
samcli/lib/init0% | 0% | 0% | 47% | 52%
samcli/lib/config0% | 0% | 0% | 56% | 43%
samcli/commands/logs0% | 0% | 0% | 56% | 43%
samcli/lib/delete0% | 0% | 0% | 79% | 20%
samcli/local/layers0% | 0% | 0% | 66% | 33%
samcli/local/services0% | 0% | 0% | 61% | 38%
samcli/lib/warnings0% | 0% | 0% | 47% | 52%
samcli/commands/traces0% | 0% | 0% | 36% | 63%
samcli0% | 0% | 0% | 34% | 65%
ROOT0% | 0% | 0% | 52% | 47%
samcli/lib/generated_sample_events0% | 0% | 0% | 0% | 100%
samcli/local/common0% | 0% | 0% | 0% | 100%
samcli/commands/bootstrap0% | 0% | 0% | 0% | 100%
samcli/commands0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_debug_settings()
in samcli/local/docker/lambda_debug_settings.py
123 4 5
def _get_stack_template()
in samcli/lib/bootstrap/bootstrap.py
94 2 0
def guided_prompts()
in samcli/commands/deploy/guided_context.py
81 12 2
def run()
in samcli/commands/build/build_context.py
73 12 1
def _request_handler()
in samcli/local/apigw/local_apigw_service.py
67 20 2
def invoke_common_options()
in samcli/commands/local/cli_common/options.py
62 2 1
def _build_stack()
in samcli/lib/iac/cfn/cfn_iac.py
61 19 4
def image_repository_validation()
in samcli/lib/cli_validation/image_repository_validation.py
60 17 1
def run()
in samcli/commands/pipeline/bootstrap/guided_context.py
54 12 1
def run()
in samcli/commands/deploy/deploy_context.py
53 11 1
def create()
in samcli/local/docker/container.py
51 16 1
def describe_stack_events()
in samcli/lib/deploy/deployer.py
50 16 4
def normalize()
in samcli/lib/samlib/resource_metadata_normalizer.py
50 27 2
def describe_changeset()
in samcli/lib/deploy/deployer.py
48 7 4
def track_command()
in samcli/lib/telemetry/metric.py
48 14 1
def delete()
in samcli/commands/delete/delete_context.py
48 12 1
def _parse_v1_payload_format_lambda_output()
in samcli/local/apigw/local_apigw_service.py
47 25 4
def bootstrap()
in samcli/lib/pipeline/bootstrap/stage.py
45 11 2
def _build_image()
in samcli/local/docker/lambda_image.py
44 13 6
def local_common_options()
in samcli/commands/local/cli_common/options.py
43 2 1