aws-samples / aws-iot-things-graph-workshop
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 34 units with 695 lines of code in units (22.8% of code).
    • 1 very long units (112 lines of code)
    • 2 long units (161 lines of code)
    • 8 medium size units (204 lines of code)
    • 10 small units (138 lines of code)
    • 13 very small units (80 lines of code)
16% | 23% | 29% | 19% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py16% | 23% | 29% | 19% | 11%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
services16% | 23% | 29% | 18% | 11%
scripts0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_current_value()
in services/read-gauge.py
112 29 11
def calibrate_gauge()
in services/read-gauge.py
86 10 4
def handler()
in services/create-iot-thing.py
75 6 2
def handler()
in services/read-gauge.py
39 5 2
def handler()
in services/lambda-proxy.py
28 2 2
def insertRecordIntoSqs()
in services/s3-new-image-event.py
25 1 1
def handler()
in services/publish-reading.py
24 3 2
def predict()
in services/read-gauge-ml.py
24 2 1
def handler()
in services/read-gauge-ml.py
22 2 2
def handler()
in services/s3-new-image-event.py
21 3 2
def process_image()
in services/read-gauge-ml.py
21 4 1
def handler()
in services/read-sqs-payload.py
18 2 2
def changeLights()
in services/lights.py
16 5 2
def GetTemperatureGauge()
in services/identify-gauge-type.py
14 1 2
def GetTSpeedGauge()
in services/identify-gauge-type.py
14 1 2
def handler()
in services/camera.py
14 2 2
def main()
in scripts/stringify-model.py
14 5 1
def get_image()
in services/read-gauge.py
13 2 3
def publishToIoTTopic()
in services/s3-new-image-event.py
12 1 1
def avg_circles()
in services/read-gauge.py
12 3 2