apple / HomeKitADK
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 1,133 units with 39,888 lines of code in units (69.6% of code).
    • 15 very complex units (6,664 lines of code)
    • 31 complex units (5,219 lines of code)
    • 109 medium complex units (9,020 lines of code)
    • 168 simple units (6,828 lines of code)
    • 810 very simple units (12,157 lines of code)
16% | 13% | 22% | 17% | 30%
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
c16% | 13% | 22% | 17% | 29%
m0% | 0% | 7% | 7% | 84%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
HAP23% | 12% | 28% | 16% | 19%
External/JSON91% | 0% | 3% | 3% | <1%
External/HTTP80% | 0% | 2% | 6% | 11%
PAL/Linux0% | 15% | 21% | 24% | 39%
PAL/POSIX0% | 15% | 21% | 24% | 39%
PAL/Raspi0% | 15% | 21% | 24% | 39%
PAL0% | 43% | 0% | 7% | 48%
Tools/AccessorySetupGenerator0% | 100% | 0% | 0% | 0%
PAL/Mock0% | 15% | 8% | 18% | 57%
External/Base640% | 0% | 61% | 38% | 0%
PAL/Darwin0% | 0% | 7% | 7% | 84%
PAL/Crypto0% | 0% | 0% | 4% | 95%
Applications/Lock0% | 0% | 0% | 9% | 90%
Applications/Lightbulb0% | 0% | 0% | 11% | 88%
Applications0% | 0% | 0% | 19% | 80%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
1450 287 7
size_t util_json_reader_read()
in External/JSON/util_json_reader.c
556 211 3
493 144 5
static bool AccessoryIsValid()
in HAP/HAPAccessoryValidation.c
650 114 1
size_t util_http_reader_read()
in External/HTTP/util_http_reader.c
370 103 3
718 103 1
static void handle_http_request()
in HAP/HAPIPAccessoryServer.c
291 101 1
HAPError HAPBLECharacteristicParseAndWriteValue()
in HAP/HAPBLECharacteristicParseAndWriteValue.c
361 88 9
248 85 4
425 81 6
408 80 5
static void read_http()
in HAP/HAPIPAccessoryServer.c
106 71 1
HAPError HAPBLECharacteristicReadAndSerializeValue()
in HAP/HAPBLECharacteristicReadAndSerializeValue.c
278 63 6
130 57 6
180 54 1
155 48 4
HAPError HAPBLEAccessoryServerDidRaiseEvent()
in HAP/HAPBLEAccessoryServer+Advertising.c
323 47 5
static void handle_secure_message()
in HAP/HAPIPAccessoryServer.c
230 39 1
129 36 2
165 36 6