facebookresearch / simmc
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 172 units with 4,278 lines of code in units (76.6% of code).
    • 9 very long units (1,484 lines of code)
    • 11 long units (824 lines of code)
    • 36 medium size units (1,096 lines of code)
    • 30 small units (443 lines of code)
    • 86 very small units (431 lines of code)
34% | 19% | 25% | 10% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py34% | 19% | 25% | 10% | 10%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mm_dst/gpt2_dst/scripts77% | 0% | 8% | 6% | 7%
mm_action_prediction/models36% | 24% | 24% | 9% | 4%
mm_action_prediction/tools19% | 26% | 30% | 7% | 15%
mm_action_prediction67% | 25% | 7% | 0% | 0%
mm_action_prediction/loaders19% | 13% | 30% | 21% | 15%
mm_dst/gpt2_dst/utils0% | 67% | 17% | 10% | 4%
mm_action_prediction/models/encoders0% | 0% | 54% | 38% | 6%
mm_dst/utils0% | 0% | 85% | 0% | 14%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in mm_dst/gpt2_dst/scripts/run_language_modeling.py
284 59 0
def read_command_line()
in mm_action_prediction/options.py
222 13 0
def forward()
in mm_action_prediction/models/action_executor.py
171 50 3
def build_multimodal_inputs()
in mm_action_prediction/tools/build_multimodal_inputs.py
170 44 1
def main()
in mm_dst/gpt2_dst/scripts/run_generation.py
149 31 0
def train()
in mm_dst/gpt2_dst/scripts/run_language_modeling.py
148 56 4
def forward_beamsearch_single()
in mm_action_prediction/models/decoder.py
130 30 4
def load_one_batch()
in mm_action_prediction/loaders/loader_simmc.py
108 21 2
def get_roundwise_dialog_actions()
in mm_action_prediction/tools/extract_actions.py
102 35 2
def convert_json_to_flattened()
in mm_dst/gpt2_dst/utils/convert.py
98 19 7
def forward()
in mm_action_prediction/models/decoder.py
97 15 3
def get_keystrokes_with_args()
in mm_action_prediction/tools/extract_actions.py
89 14 2
def evaluate_agent()
in mm_action_prediction/eval_simmc_agent.py
83 19 3
def __init__()
in mm_action_prediction/loaders/loader_simmc.py
74 27 2
def extract_actions()
in mm_action_prediction/tools/extract_actions.py
72 5 4
def extract_actions()
in mm_action_prediction/tools/extract_actions_fashion.py
69 16 1
def weight_init()
in mm_action_prediction/tools/weight_init.py
68 35 1
def gen_getinfo_from_annotation()
in mm_action_prediction/tools/extract_actions.py
65 37 2
def forward()
in mm_action_prediction/models/assistant.py
57 11 3
def __init__()
in mm_action_prediction/models/decoder.py
52 13 2