awslabs / aws-solutions-constructs
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 303 units with 7,031 lines of code in units (69.8% of code).
    • 6 very long units (708 lines of code)
    • 26 long units (1,690 lines of code)
    • 86 medium size units (2,822 lines of code)
    • 79 small units (1,143 lines of code)
    • 106 very small units (668 lines of code)
10% | 24% | 40% | 16% | 9%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts9% | 26% | 41% | 14% | 8%
js19% | 11% | 35% | 28% | 5%
py0% | 0% | 21% | 36% | 42%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/patterns/@aws-solutions-constructs8% | 25% | 42% | 15% | 8%
source/use_cases/aws-serverless-image-handler19% | 19% | 35% | 18% | 6%
source/use_cases/aws-restaurant-management-demo50% | 0% | 43% | 4% | 1%
source/use_cases/aws-serverless-web-app0% | 53% | 0% | 24% | 21%
source/use_cases/aws-custom-glue-etl0% | 39% | 28% | 21% | 10%
source/tools/cdk-integ-tools0% | 0% | 41% | 26% | 31%
source/use_cases/aws-s3-static-website0% | 0% | 52% | 12% | 34%
deployment/v20% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
mapFilter()
in source/use_cases/aws-serverless-image-handler/lib/lambda/image-handler/thumbor-mapping.js
138 36 2
constructor()
in source/use_cases/aws-restaurant-management-demo/lib/manager-stack.ts
129 1 3
function addPermissions()
in source/patterns/@aws-solutions-constructs/core/lib/sagemaker-helper.ts
124 7 2
export function buildElasticSearchCWAlarms()
in source/patterns/@aws-solutions-constructs/core/lib/elasticsearch-helper.ts
112 1 1
export function CheckProps()
in source/patterns/@aws-solutions-constructs/core/lib/input-validation.ts
103 53 1
constructor()
in source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/lib/index.ts
102 15 3
export function CreateFargateService()
in source/patterns/@aws-solutions-constructs/core/lib/fargate-helper.ts
97 6 9
constructor()
in source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/lib/index.ts
96 7 3
export function deployLambdaFunction()
in source/patterns/@aws-solutions-constructs/core/lib/lambda-helper.ts
87 15 4
constructor()
in source/patterns/@aws-solutions-constructs/aws-apigateway-iot/lib/index.ts
85 6 3
async applyEdits()
in source/use_cases/aws-serverless-image-handler/lib/lambda/image-handler/image-handler.js
80 16 2
export function addProxyMethodToApiResource()
in source/patterns/@aws-solutions-constructs/core/lib/apigateway-helper.ts
74 6 1
export function deployGlueJob()
in source/patterns/@aws-solutions-constructs/core/lib/glue-job-helper.ts
72 11 5
constructor()
in source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/lib/index.ts
68 10 3
constructor()
in source/patterns/@aws-solutions-constructs/aws-alb-fargate/lib/index.ts
66 6 3
export function buildSagemakerNotebook()
in source/patterns/@aws-solutions-constructs/core/lib/sagemaker-helper.ts
66 13 2
constructor()
in source/patterns/@aws-solutions-constructs/aws-apigateway-sagemakerendpoint/lib/index.ts
62 4 3
constructor()
in source/use_cases/aws-serverless-web-app/lib/serverless-backend-stack.ts
62 1 3
export function CheckFargateProps()
in source/patterns/@aws-solutions-constructs/core/lib/fargate-helper.ts
60 23 1
export function buildElasticSearch()
in source/patterns/@aws-solutions-constructs/core/lib/elasticsearch-helper.ts
59 4 4