awslabs / aws-c-iot
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 106 units with 2,168 lines of code in units (75.5% of code).
    • 3 very long units (484 lines of code)
    • 5 long units (345 lines of code)
    • 24 medium size units (714 lines of code)
    • 19 small units (248 lines of code)
    • 55 very small units (377 lines of code)
22% | 15% | 32% | 11% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c22% | 15% | 32% | 11% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source21% | 11% | 38% | 12% | 16%
source/linux30% | 42% | 10% | 6% | 9%
source/apple0% | 0% | 0% | 0% | 100%
source/windows0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static int s_get_metric_report_json()
in source/device_defender.c
255 63 7
static int s_defender_task_create()
in source/device_defender.c
123 12 5
106 12 5
int get_network_config_and_transfer()
in source/linux/network.c
95 16 2
static void s_reporting_task_fn()
in source/device_defender.c
92 14 3
55 18 3
static void s_get_custom_metrics_data()
in source/device_defender.c
52 8 3
int get_network_connections()
in source/linux/network.c
51 7 3
static int s_mqtt_report_publish_fn()
in source/device_defender.c
44 4 2
43 4 6
int read_proc_net_from_file()
in source/linux/network.c
37 7 4
int s_copy_task_config()
in source/device_defender.c
34 3 2
33 10 3
static int s_init_data_tunnel_pair()
in source/secure_tunneling.c
33 4 4
static void s_mqtt_on_suback()
in source/device_defender.c
33 3 6
33 10 3
static int s_init_custom_metric_data()
in source/device_defender.c
31 8 2
30 2 4
30 3 4
30 3 4