apple / ml-uwac
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 651 units with 5,906 lines of code in units (64.5% of code).
    • 4 very long units (486 lines of code)
    • 10 long units (724 lines of code)
    • 43 medium size units (1,273 lines of code)
    • 75 small units (1,086 lines of code)
    • 519 very small units (2,337 lines of code)
8% | 12% | 21% | 18% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 12% | 21% | 18% | 39%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
rlkit/launchers35% | 22% | 28% | 5% | 7%
rlkit/torch11% | 11% | 17% | 19% | 39%
rlkit/data_management0% | 32% | 7% | 18% | 41%
rlkit/core0% | 11% | 35% | 19% | 33%
rlkit/envs0% | 0% | 25% | 27% | 46%
rlkit/samplers0% | 0% | 21% | 21% | 57%
rlkit0% | 0% | 22% | 17% | 60%
scripts0% | 0% | 60% | 39% | 0%
rlkit/util0% | 0% | 10% | 18% | 70%
rlkit/exploration_strategies0% | 0% | 0% | 0% | 100%
rlkit/policies0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def generate_vae_dataset()
in rlkit/launchers/skewfit_experiments.py
137 25 1
def train_from_torch()
in rlkit/torch/sac/uwac_dropout.py
127 15 2
def skewfit_experiment()
in rlkit/launchers/skewfit_experiments.py
111 3 1
def train_from_torch()
in rlkit/torch/sac/bear.py
111 13 2
def get_envs()
in rlkit/launchers/skewfit_experiments.py
100 8 1
def train_from_torch()
in rlkit/torch/sac/sac.py
87 6 2
def refresh_latents()
in rlkit/data_management/online_vae_replay_buffer.py
82 5 2
def train_from_torch()
in rlkit/torch/ddpg/ddpg.py
80 5 2
def train_from_torch()
in rlkit/torch/td3/td3.py
78 4 2
def random_batch()
in rlkit/data_management/obs_dict_replay_buffer.py
69 7 2
def _train()
in rlkit/core/batch_rl_algorithm.py
61 13 1
def train_vae()
in rlkit/launchers/skewfit_experiments.py
60 10 2
def add_path()
in rlkit/data_management/obs_dict_replay_buffer.py
55 9 2
def _visualize()
in rlkit/core/batch_rl_algorithm.py
52 4 6
def rollout()
in rlkit/samplers/util.py
49 7 4
def get_generic_path_information()
in rlkit/core/eval_util.py
45 14 2
def get_video_save_func()
in rlkit/launchers/skewfit_experiments.py
45 6 4
def train_epoch()
in rlkit/torch/vae/vae_trainer.py
44 7 5
def _train()
in rlkit/core/online_rl_algorithm.py
42 6 1
def _log_stats()
in rlkit/core/rl_algorithm.py
42 5 2