facebookresearch / MTRF
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 857 units with 10,772 lines of code in units (68.7% of code).
    • 6 very long units (721 lines of code)
    • 26 long units (1,713 lines of code)
    • 114 medium size units (3,502 lines of code)
    • 150 small units (2,203 lines of code)
    • 561 very small units (2,633 lines of code)
6% | 15% | 32% | 20% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 15% | 32% | 20% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
MTRF/algorithms/softlearning/algorithms15% | 19% | 41% | 11% | 12%
MTRF/r3l/r3l/r3l_envs9% | 4% | 26% | 22% | 37%
MTRF/algorithms/softlearning/policies30% | 0% | 21% | 19% | 27%
MTRF/algorithms/softlearning/models17% | 12% | 40% | 12% | 16%
MTRF/r3l/r3l/r3l_agents0% | 63% | 15% | 10% | 10%
MTRF/algorithms/softlearning/environments0% | 21% | 29% | 17% | 31%
MTRF/algorithms/softlearning/samplers0% | 22% | 16% | 28% | 32%
MTRF/algorithms/softlearning/preprocessors0% | 9% | 36% | 22% | 31%
MTRF/algorithms/softlearning/replay_pools0% | 7% | 47% | 26% | 17%
MTRF/algorithms/scripts0% | 23% | 18% | 32% | 25%
MTRF/algorithms/softlearning/rnd0% | 100% | 0% | 0% | 0%
MTRF/r3l/r3l/robot0% | 0% | 28% | 32% | 38%
MTRF/r3l/r3l/utils0% | 0% | 30% | 39% | 29%
MTRF/algorithms/softlearning/distributions0% | 0% | 80% | 0% | 19%
MTRF/algorithms/softlearning/value_functions0% | 0% | 64% | 14% | 21%
MTRF/algorithms/softlearning/misc0% | 0% | 24% | 44% | 30%
MTRF/algorithms/softlearning/scripts0% | 0% | 38% | 26% | 34%
MTRF/r3l/r3l/sawyer_hardware0% | 0% | 41% | 53% | 5%
MTRF/algorithms/softlearning/utils0% | 0% | 0% | 73% | 26%
MTRF/r3l/r3l0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_obs_dict()
in MTRF/r3l/r3l/r3l_envs/inhand_env/base.py
139 15 1
def _train()
in MTRF/algorithms/softlearning/algorithms/phased_sac.py
134 14 1
def __init__()
in MTRF/algorithms/softlearning/policies/gaussian_policy.py
119 6 8
def get_diagnostics()
in MTRF/algorithms/softlearning/algorithms/multi_sac.py
112 19 5
def convnet_model()
in MTRF/algorithms/softlearning/models/convnet.py
112 10 3
def _train()
in MTRF/algorithms/softlearning/algorithms/multi_sac.py
105 21 1
def _train()
in MTRF/algorithms/softlearning/algorithms/rl_algorithm.py
91 17 1
def reset_model()
in MTRF/algorithms/softlearning/environments/gym/mujoco/pusher_2d.py
89 16 1
def convnet_transpose_model()
in MTRF/algorithms/softlearning/models/convnet.py
80 11 3
def rollout()
in MTRF/algorithms/softlearning/samplers/utils.py
77 18 10
def _init_svgd_update()
in MTRF/algorithms/softlearning/algorithms/sql.py
75 8 1
def do_evals()
in MTRF/r3l/r3l/r3l_agents/softlearning/evaluation_scripts/phased_evals_reorient.py
72 8 1
def do_evals()
in MTRF/r3l/r3l/r3l_agents/softlearning/evaluation_scripts/video_collection_flipup_evals.py
71 12 4
def do_evals()
in MTRF/r3l/r3l/r3l_agents/softlearning/evaluation_scripts/phased_evals_reposition.py
71 8 1
def __init__()
in MTRF/algorithms/softlearning/environments/adapters/gym_adapter.py
68 20 7
def do_evals()
in MTRF/r3l/r3l/r3l_agents/softlearning/evaluation_scripts/phased_evals_midair.py
67 24 2
def do_evals()
in MTRF/r3l/r3l/r3l_agents/softlearning/evaluation_scripts/phased_evals_flipup.py
66 9 1
def _init_actor_updates()
in MTRF/algorithms/softlearning/algorithms/phased_sac.py
64 9 1
def _init_actor_updates()
in MTRF/algorithms/softlearning/algorithms/multi_sac.py
64 9 1
def main()
in MTRF/r3l/r3l/r3l_agents/examine_random_policy.py
64 14 0