facebookresearch / LearningToLearn
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 136 units with 1,280 lines of code in units (61.3% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (126 lines of code)
    • 12 medium size units (316 lines of code)
    • 29 small units (429 lines of code)
    • 93 very small units (409 lines of code)
0% | 9% | 24% | 33% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 9% | 24% | 33% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mbirl/experiments0% | 76% | 0% | 20% | 3%
ml30% | 7% | 34% | 29% | 27%
ml3/envs0% | 0% | 21% | 46% | 32%
mbirl0% | 0% | 0% | 25% | 75%
ml3/experiments0% | 0% | 0% | 41% | 58%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def irl_training()
in mbirl/experiments/run_model_based_irl.py
71 11 11
def meta_train()
in ml3/sine_regression_task.py
55 9 6
def meta_train_shaped_sine()
in ml3/ml3_train.py
40 6 8
def render()
in ml3/envs/mountain_car.py
30 3 4
def train_model()
in ml3/mbrl_utils.py
29 6 2
28 10 10
def main()
in ml3/sine_regression_task.py
28 4 1
def render()
in ml3/shaped_sine_utils.py
26 2 6
def plot_loss()
in ml3/shaped_sine_utils.py
25 3 3
def __init__()
in ml3/envs/reacher_sim.py
24 6 6
22 4 10
def eval()
in ml3/sine_regression_task.py
22 2 4
def __init__()
in ml3/mbrl_utils.py
21 2 2
def __init__()
in ml3/envs/bullet_sim.py
21 2 6
def __init__()
in ml3/mbrl_utils.py
19 1 2
def evaluate_action_optimization()
in mbirl/experiments/run_model_based_irl.py
19 3 6
def __init__()
in ml3/sine_task_sampler.py
18 1 13
def roll_out()
in ml3/optimizee.py
18 3 6
def apply_joint_torque()
in ml3/envs/bullet_sim.py
18 3 2
def step()
in ml3/envs/mountain_car.py
18 8 2