aws-samples / smart-cooler
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 150 units with 1,246 lines of code in units (39.9% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (153 lines of code)
    • 7 medium size units (238 lines of code)
    • 26 small units (373 lines of code)
    • 115 very small units (482 lines of code)
0% | 12% | 19% | 29% | 38%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 15% | 17% | 25% | 41%
js0% | 0% | 24% | 46% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
purchase-function0% | 34% | 8% | 24% | 32%
detection-function0% | 13% | 16% | 25% | 44%
qr-reader-function0% | 0% | 54% | 18% | 27%
door-sensor-function0% | 0% | 100% | 0% | 0%
SmartCoolerCharge0% | 0% | 24% | 46% | 29%
SmartCoolerScan0% | 0% | 24% | 46% | 29%
authentication-function0% | 0% | 0% | 27% | 72%
update-product-local-function0% | 0% | 0% | 100% | 0%
qr-monitoring-function0% | 0% | 0% | 27% | 72%
update-product-function0% | 0% | 0% | 37% | 62%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def transaction()
in purchase-function/src/purchase.py
96 17 2
def extract_bounding_boxes()
in detection-function/src/run.py
57 13 1
def print_()
in detection-function/src/six.py
50 22 2
def reading_qr_run()
in qr-reader-function/src/qr_reader.py
42 11 0
def run_loop()
in door-sensor-function/src/door_sensor.py
34 7 0
exports.signHeaders = function()
in SmartCoolerCharge/clientHelper.js
33 6 2
exports.signHeaders = function()
in SmartCoolerScan/clientHelper.js
33 6 2
def _initialize_database()
in purchase-function/src/inventory.py
24 2 1
def get_iou()
in detection-function/src/run.py
22 8 2
exports.retryLogic = function()
in SmartCoolerCharge/clientHelper.js
19 5 2
exports.retryLogic = function()
in SmartCoolerScan/clientHelper.js
19 5 2
function charge()
in SmartCoolerCharge/index.js
18 1 2
def auth_run()
in authentication-function/src/authenticate.py
18 1 2
def get_previous_snapshot()
in purchase-function/src/inventory.py
18 2 2
function merchantScan()
in SmartCoolerScan/index.js
18 1 2
def __init__()
in detection-function/src/six.py
17 6 6
def add_snapshot()
in purchase-function/src/inventory.py
17 2 3
def add_metaclass()
in detection-function/src/six.py
15 5 1
def put_s3()
in detection-function/src/run.py
14 1 4
def _update_wrapper()
in detection-function/src/six.py
14 4 4