aws-samples / monitor-ml-models-efficiently-across-fleets-of-devices-aim325
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 126 units with 1,554 lines of code in units (67.4% of code).
    • 1 very long units (157 lines of code)
    • 2 long units (105 lines of code)
    • 15 medium size units (476 lines of code)
    • 30 small units (425 lines of code)
    • 78 very small units (391 lines of code)
10% | 6% | 30% | 27% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 6% | 30% | 27% | 25%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lab48% | 16% | 12% | 17% | 5%
setup0% | 100% | 0% | 0% | 0%
lab/app0% | 0% | 39% | 30% | 30%
lab/app_ggv20% | 0% | 33% | 31% | 34%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def setup_roles_and_policies()
in lab/setup_utils.py
157 5 1
def setup_agent()
in setup/run.py
53 5 4
def modify_device_role()
in lab/setup_utils.py
52 2 1
def __process_job__()
in lab/app/ota.py
42 7 3
def add_AgentServicer_to_server()
in lab/app/agent_pb2_grpc.py
41 1 2
def add_AgentServicer_to_server()
in lab/app_ggv2/agent_pb2_grpc.py
41 1 2
def __init__()
in lab/app/ota.py
40 6 7
def train()
in lab/wind_turbine.py
39 8 1
def __init__()
in lab/app/agent_pb2_grpc.py
36 1 2
def __init__()
in lab/app_ggv2/agent_pb2_grpc.py
36 1 2
def __init__()
in lab/app/turbine.py
30 4 3
def __detect_anomalies__()
in lab/app/windfarm.py
29 10 1
def __detect_anomalies__()
in lab/app_ggv2/windfarm.py
27 9 1
def predict()
in lab/app/edgeagentclient.py
25 5 4
def predict()
in lab/app_ggv2/edgeagentclient.py
25 5 4
def __init__()
in lab/app_ggv2/windfarm.py
23 9 2
def __init__()
in lab/app/windfarm.py
21 7 4
def __on_message__()
in lab/app/ota.py
21 9 4
def create_model()
in lab/wind_turbine.py
18 1 2
def train_epoch()
in lab/wind_turbine.py
17 5 6