aws-samples / connected-drink-dispenser-workshop
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 7,383 units with 105,360 lines of code in units (54.9% of code).
    • 100 very long units (14,179 lines of code)
    • 309 long units (21,286 lines of code)
    • 847 medium size units (26,955 lines of code)
    • 1,252 small units (18,192 lines of code)
    • 4,875 very small units (24,748 lines of code)
13% | 20% | 25% | 17% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c18% | 27% | 28% | 15% | 9%
py7% | 10% | 25% | 20% | 35%
js0% | 56% | 9% | 9% | 24%
h0% | <1% | 5% | 18% | 74%
go0% | 0% | 36% | 54% | 9%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
device_firmware/libraries23% | 27% | 31% | 10% | 6%
device_firmware/freertos_kernel6% | 19% | 18% | 22% | 33%
deploy/lambda_functions8% | 11% | 25% | 20% | 35%
deploy/cdd0% | 35% | 29% | 4% | 30%
device_firmware/tools0% | 6% | 38% | 22% | 32%
deploy/source_files0% | 77% | 0% | 0% | 22%
deploy0% | 0% | 62% | 17% | 19%
dispenser_app/src0% | 0% | 35% | 35% | 28%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
BaseType_t FreeRTOS_setsockopt()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_Sockets.c
299 60 5
static IotMqttError_t _deserializeIncomingPacket()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_network.c
297 32 2
IotMqttError_t IotMqtt_Connect()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_api.c
276 28 4
static DocParseErr_t prvParseJSONbyModel()
in device_firmware/libraries/freertos_plus/aws/ota/src/aws_iot_ota_agent.c
252 32 3
static void ksz8851snl_update()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/portable/NetworkInterface/ksz8851snl/NetworkInterface.c
216 29 0
def parsedebug()
in deploy/lambda_functions/api_get_resources/pycparser/ply/yacc.py
215 20 6
IotMqttError_t IotMqtt_Publish()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_api.c
208 23 5
def yacc()
in deploy/lambda_functions/api_get_resources/pycparser/ply/yacc.py
204 26 13
static uint32_t prvParseDNSReply()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_DNS.c
201 26 3
bool _IotMqtt_ValidateSubscriptionList()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_validate.c
197 25 4
void vDHCPProcess()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_DHCP.c
195 28 1
static void prvTCPReturnPacket()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_TCP_IP.c
190 27 4
static void _networkReceiveCallback()
in device_firmware/libraries/c_sdk/standard/https/src/iot_https_client.c
188 35 2
static void prvInitialiseNewTask()
in device_firmware/freertos_kernel/tasks.c
184 8 8
def parseopt()
in deploy/lambda_functions/api_get_resources/pycparser/ply/yacc.py
183 17 6
static void prvOTAUpdateTask()
in device_firmware/libraries/freertos_plus/aws/ota/src/aws_iot_ota_agent.c
182 34 1
void PendSV_Handler()
in device_firmware/freertos_kernel/portable/GCC/ARM_CM23/non_secure/portasm.c
176 1 1
void PendSV_Handler()
in device_firmware/freertos_kernel/portable/ARMv8M/non_secure/portable/GCC/ARM_CM23/portasm.c
176 1 1
asm volatile()
in device_firmware/freertos_kernel/portable/GCC/ATMega323/port.c
171 1 1
static IotMqttError_t _subscriptionCommon()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_api.c
171 21 7