aws-samples / connected-drink-dispenser-workshop
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 7,383 units with 105,360 lines of code in units (54.9% of code).
    • 2 very complex units (427 lines of code)
    • 33 complex units (5,033 lines of code)
    • 211 medium complex units (16,790 lines of code)
    • 575 simple units (22,208 lines of code)
    • 6,562 very simple units (60,902 lines of code)
<1% | 4% | 15% | 21% | 57%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
c<1% | 5% | 19% | 25% | 50%
py<1% | 5% | 14% | 19% | 59%
h0% | 0% | <1% | 1% | 98%
js0% | 0% | 0% | 0% | 100%
go0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
device_firmware/libraries<1% | 8% | 27% | 27% | 35%
deploy/lambda_functions<1% | 6% | 15% | 19% | 58%
device_firmware/freertos_kernel0% | 0% | 3% | 14% | 81%
device_firmware/tools0% | 0% | 4% | 19% | 76%
deploy/cdd0% | 0% | 0% | 35% | 64%
deploy0% | 0% | 0% | 20% | 79%
deploy/source_files0% | 0% | 0% | 0% | 100%
dispenser_app/src0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex 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
def lex()
in deploy/lambda_functions/api_get_resources/pycparser/ply/lex.py
128 54 6
def _build()
in deploy/lambda_functions/api_get_resources/asn1crypto/core.py
162 48 9
def __init__()
in deploy/lambda_functions/api_get_resources/asn1crypto/core.py
132 46 11
bool IotJsonUtils_FindJsonValue()
in device_firmware/libraries/c_sdk/standard/serializer/src/iot_json_utils.c
145 43 6
def lr_parse_table()
in deploy/lambda_functions/api_get_resources/pycparser/ply/yacc.py
139 41 1
def _parse_children()
in deploy/lambda_functions/api_get_resources/asn1crypto/core.py
106 40 2
def parsegen()
in deploy/lambda_functions/api_get_resources/pycparser/ply/cpp.py
107 38 3
def new_primitive_type()
in deploy/lambda_functions/api_get_resources/cffi/backend_ctypes.py
137 36 2
def _generate_cpy_function_decl()
in deploy/lambda_functions/api_get_resources/cffi/recompiler.py
132 35 3
static void _networkReceiveCallback()
in device_firmware/libraries/c_sdk/standard/https/src/iot_https_client.c
188 35 2
static void prvOTAUpdateTask()
in device_firmware/libraries/freertos_plus/aws/ota/src/aws_iot_ota_agent.c
182 34 1
int32_t SOCKETS_SetSockOpt()
in device_firmware/libraries/abstractions/secure_sockets/lwip/iot_secure_sockets.c
155 32 5
static DocParseErr_t prvParseJSONbyModel()
in device_firmware/libraries/freertos_plus/aws/ota/src/aws_iot_ota_agent.c
252 32 3
static IotMqttError_t _deserializeIncomingPacket()
in device_firmware/libraries/c_sdk/standard/mqtt/src/iot_mqtt_network.c
297 32 2
static BaseType_t prvProcessDHCPReplies()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_DHCP.c
144 30 1
void vSocketSelect()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/FreeRTOS_Sockets.c
123 30 1
def new_array_type()
in deploy/lambda_functions/api_get_resources/cffi/backend_ctypes.py
106 29 3
def _parse_children()
in deploy/lambda_functions/api_get_resources/asn1crypto/core.py
81 29 2
static void ksz8851snl_update()
in device_firmware/libraries/freertos_plus/standard/freertos_plus_tcp/source/portable/NetworkInterface/ksz8851snl/NetworkInterface.c
216 29 0