aws / serverless-application-model
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 774 units with 8,026 lines of code in units (49.0% of code).
    • 2 very long units (281 lines of code)
    • 9 long units (619 lines of code)
    • 82 medium size units (2,486 lines of code)
    • 152 small units (2,222 lines of code)
    • 529 very small units (2,418 lines of code)
3% | 7% | 30% | 27% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 7% | 30% | 27% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
samtranslator/model6% | 10% | 36% | 26% | 19%
samtranslator/translator0% | 33% | 0% | 43% | 23%
samtranslator/swagger0% | 9% | 35% | 20% | 33%
samtranslator/plugins0% | 0% | 38% | 25% | 35%
integration/helpers0% | 0% | 23% | 32% | 43%
samtranslator/utils0% | 0% | 29% | 23% | 46%
samtranslator/open_api0% | 0% | 19% | 31% | 49%
samtranslator/parser0% | 0% | 62% | 25% | 11%
samtranslator/feature_toggle0% | 0% | 25% | 17% | 56%
samtranslator/intrinsics0% | 0% | 9% | 34% | 55%
integration0% | 0% | 0% | 48% | 52%
samtranslator/validator0% | 0% | 0% | 51% | 48%
samtranslator0% | 0% | 0% | 72% | 27%
samtranslator/metrics0% | 0% | 0% | 23% | 76%
samtranslator/sdk0% | 0% | 0% | 20% | 80%
samtranslator/policy_template_processor0% | 0% | 0% | 22% | 77%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _add_swagger_integration()
in samtranslator/model/eventsources/push.py
176 49 4
def _construct_api_domain()
in samtranslator/model/api/api_generator.py
105 30 2
def translate()
in samtranslator/translator/translator.py
82 18 5
def _add_swagger_integration()
in samtranslator/model/stepfunctions/events.py
81 28 5
def _construct_api_domain()
in samtranslator/model/api/http_api_generator.py
70 19 2
def _construct_usage_plan()
in samtranslator/model/api/api_generator.py
70 23 2
def get_policy_statements()
in samtranslator/model/eventsources/pull.py
68 10 1
def to_cloudformation()
in samtranslator/model/sam_resources.py
66 12 2
def to_cloudformation()
in samtranslator/model/eventsources/pull.py
64 26 2
def to_cloudformation()
in samtranslator/model/sam_resources.py
62 6 2
def add_resource_policy()
in samtranslator/swagger/swagger.py
56 9 4
def _add_vpc_resource_policy_for_method()
in samtranslator/swagger/swagger.py
50 18 4
def _add_auth_to_openapi_integration()
in samtranslator/model/eventsources/push.py
50 16 3
def describe_stack_events()
in integration/helpers/deployer/deployer.py
50 16 4
def _validate_and_inject_resource()
in samtranslator/model/sam_resources.py
48 12 5
def describe_changeset()
in integration/helpers/deployer/deployer.py
48 7 4
def _construct_event_invoke_config()
in samtranslator/model/sam_resources.py
47 11 6
def to_cloudformation()
in samtranslator/model/eventsources/push.py
47 6 2
def to_cloudformation()
in samtranslator/model/stepfunctions/generators.py
45 13 1
def _openapi_postprocess()
in samtranslator/model/api/api_generator.py
43 31 2