awslabs / aws-crt-nodejs
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 399 units with 6,622 lines of code in units (76.8% of code).
    • 9 very long units (1,290 lines of code)
    • 15 long units (979 lines of code)
    • 64 medium size units (1,984 lines of code)
    • 80 small units (1,144 lines of code)
    • 231 very small units (1,225 lines of code)
19% | 14% | 29% | 17% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c24% | 18% | 31% | 16% | 8%
ts0% | 0% | 19% | 22% | 58%
js0% | 0% | 71% | 13% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source24% | 18% | 31% | 16% | 8%
lib/browser0% | 0% | 24% | 26% | 49%
lib/native0% | 0% | 17% | 18% | 63%
scripts0% | 0% | 71% | 13% | 15%
lib/common0% | 0% | 0% | 25% | 75%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
napi_value aws_napi_mqtt_client_connection_new()
in source/mqtt_client_connection.c
204 19 2
194 43 2
183 26 8
140 13 2
napi_value aws_napi_http_connection_manager_new()
in source/http_connection_manager.c
131 11 2
128 12 2
108 1 2
101 7 2
101 8 2
97 10 2
86 14 2
80 4 2
79 5 2
69 18 2
67 18 3
napi_status aws_napi_define_class()
in source/class_binder.c
65 8 8
58 4 2
57 13 5
57 10 2
56 7 3