aws-solutions / smart-product-solution
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 133 units with 4,696 lines of code in units (27.4% of code).
    • 7 very long units (1,606 lines of code)
    • 18 long units (1,165 lines of code)
    • 40 medium size units (1,336 lines of code)
    • 21 small units (317 lines of code)
    • 47 very small units (272 lines of code)
34% | 24% | 28% | 6% | 5%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts93% | 3% | 2% | 0% | <1%
js3% | 35% | 41% | 10% | 8%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
deployment/custom-deployment/lib93% | 3% | 2% | 0% | <1%
source/resources/helper18% | 35% | 32% | 10% | 4%
source/services/api0% | 41% | 46% | 5% | 6%
source/services/notification0% | 40% | 49% | 6% | 3%
source/services/jitr0% | 46% | 0% | 45% | 8%
source/services/event-proxy0% | 55% | 26% | 12% | 7%
source/resources/authorizer0% | 21% | 76% | 0% | 2%
source/services/command-status0% | 0% | 69% | 19% | 11%
source/resources/usage-metrics0% | 0% | 91% | 0% | 8%
deployment/manifest-generator0% | 0% | 0% | 100% | 0%
source/resources/cicd0% | 0% | 0% | 30% | 69%
source/services/telemetry0% | 0% | 0% | 100% | 0%
source/resources/logger0% | 0% | 0% | 0% | 100%
source/resources/cognito0% | 0% | 0% | 0% | 100%
source/resources/utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in deployment/custom-deployment/lib/smart-product-api.ts
619 1 3
constructor()
in deployment/custom-deployment/lib/smart-product-solution-stack.ts
334 12 3
constructor()
in deployment/custom-deployment/lib/smart-product-event.ts
188 1 3
constructor()
in deployment/custom-deployment/lib/smart-product-owner-web-app.ts
136 1 3
updateIoTDeviceDefender()
in source/resources/helper/lib/iot-helper.js
113 6 4
constructor()
in deployment/custom-deployment/lib/smart-product-telemetry.ts
112 1 3
constructor()
in deployment/custom-deployment/lib/smart-product-jitr.ts
104 1 3
async createRegistration()
in source/services/api/registration/lib/registration.js
91 16 2
async createCommand()
in source/services/api/command/lib/command.js
87 22 3
async deleteDevice()
in source/services/api/device/lib/device.js
80 11 2
async _getAlertsPage()
in source/services/api/event/lib/event.js
80 13 6
async sendAlert()
in source/services/notification/lib/alert.js
79 15 1
async getDeviceStatus()
in source/services/api/status/lib/status.js
68 12 2
async _getEventHistoryPage()
in source/services/api/event/lib/event.js
67 11 6
async _registrationUpdate()
in source/services/jitr/lib/jitrHelper.js
67 9 1
async _getAlertsCount()
in source/services/api/event/lib/event.js
59 8 3
constructor()
in deployment/custom-deployment/lib/smart-product-device-defender.ts
59 1 3
copyAssets()
in source/resources/helper/lib/s3-helper.js
57 3 4
async createEvent()
in source/services/event-proxy/lib/message.js
55 10 1
_downloadManifest()
in source/resources/helper/lib/s3-helper.js
54 4 2