facebookresearch / habitat-lab
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 1,503 units with 11,484 lines of code in units (49.6% of code).
    • 5 very long units (636 lines of code)
    • 16 long units (1,062 lines of code)
    • 81 medium size units (2,456 lines of code)
    • 153 small units (2,153 lines of code)
    • 1,248 very small units (5,177 lines of code)
5% | 9% | 21% | 18% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 9% | 21% | 18% | 45%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
habitat_baselines/il26% | 22% | 15% | 5% | 30%
habitat_baselines/rl19% | 14% | 16% | 13% | 35%
habitat/datasets11% | 12% | 29% | 17% | 29%
habitat/tasks0% | 7% | 21% | 24% | 47%
habitat_baselines/agents0% | 11% | 30% | 24% | 33%
habitat_baselines/slambased0% | 9% | 37% | 23% | 29%
habitat_baselines/utils0% | 18% | 6% | 11% | 63%
habitat/sims0% | 9% | 8% | 24% | 58%
habitat/utils0% | 0% | 41% | 11% | 46%
habitat_baselines/common0% | 0% | 17% | 20% | 61%
habitat/core0% | 0% | 8% | 13% | 77%
habitat_baselines/motion_planning0% | 0% | 16% | 20% | 62%
habitat_baselines0% | 0% | 55% | 35% | 10%
ROOT0% | 0% | 0% | 0% | 100%
habitat/config0% | 0% | 0% | 0% | 100%
habitat_baselines/config0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in habitat_baselines/il/trainers/pacman_trainer.py
161 8 1
def train()
in habitat_baselines/rl/ppo/ppo_trainer.py
126 20 1
def train()
in habitat_baselines/il/trainers/vqa_trainer.py
121 8 1
def _init_train()
in habitat_baselines/rl/ppo/ppo_trainer.py
115 17 1
def generate_single_episode()
in habitat/datasets/rearrange/rearrange_generator.py
113 22 1
def calculate_local_path_costs()
in habitat_baselines/slambased/path_planners.py
94 2 2
def map_dataset_sample()
in habitat_baselines/il/data/nav_data.py
92 14 2
def reconfigure()
in habitat/tasks/rearrange/rearrange_sim.py
80 20 2
def forward()
in habitat_baselines/il/models/models.py
73 2 2
def _get_resource_sets()
in habitat/datasets/rearrange/rearrange_generator.py
69 8 1
def train()
in habitat_baselines/il/trainers/eqa_cnn_pretrain_trainer.py
69 4 1
def main()
in habitat_baselines/agents/mp_agents.py
68 3 0
def update()
in habitat_baselines/rl/ppo/ppo.py
68 4 2
def __init__()
in habitat_baselines/utils/gym_adapter.py
67 15 3
def _collect_environment_result()
in habitat_baselines/rl/ppo/ppo_trainer.py
60 7 2
def __init__()
in habitat_baselines/agents/ppo_agents.py
58 8 2
def _setup_actor_critic_agent()
in habitat_baselines/rl/ppo/ppo_trainer.py
56 12 2
def update_metric()
in habitat/tasks/rearrange/sub_tasks/pick_sensors.py
53 11 6
def get()
in habitat/sims/habitat_simulator/actions.py
53 2 1
def _gen_start_pos()
in habitat/tasks/rearrange/sub_tasks/pick_task.py
51 16 3