facebookresearch / simmc2
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 67 units with 1,254 lines of code in units (48.0% of code).
    • 1 very long units (373 lines of code)
    • 3 long units (208 lines of code)
    • 11 medium size units (306 lines of code)
    • 13 small units (192 lines of code)
    • 39 very small units (175 lines of code)
29% | 16% | 24% | 15% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py29% | 16% | 24% | 15% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mm_dst/gpt2_dst/scripts59% | 0% | 11% | 14% | 15%
mm_dst/utils0% | 64% | 0% | 21% | 14%
disambiguate0% | 40% | 44% | 0% | 15%
utils0% | 0% | 65% | 28% | 5%
mm_dst/gpt2_dst/utils0% | 0% | 61% | 21% | 17%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in model/mm_dst/gpt2_dst/scripts/run_language_modeling.py
373 59 0
def main()
in model/disambiguate/train_model.py
79 14 1
def evaluate_frame()
in model/mm_dst/utils/evaluate_dst.py
74 31 3
def evaluate_from_flat_list()
in model/mm_dst/utils/evaluate_dst.py
55 2 2
def parse_flattened_result()
in model/mm_dst/gpt2_dst/utils/convert.py
35 8 1
def get_indexed_data()
in model/disambiguate/dataloader.py
32 9 2
def evaluate_response_retrieval()
in model/utils/retrieval_evaluation.py
32 8 3
def draw_bboxes()
in model/utils/visualize_bboxes.py
31 4 4
def main()
in model/disambiguate/format_disambiguation_data.py
29 8 1
def main()
in model/mm_dst/gpt2_dst/scripts/format_retrieval_results.py
27 6 1
def main()
in model/utils/visualize_bboxes.py
27 8 1
def evaluate_model()
in model/disambiguate/train_model.py
26 9 5
def main()
in model/mm_dst/gpt2_dst/scripts/run_generation.py
23 1 0
def main()
in model/mm_dst/gpt2_dst/scripts/run_retrieval.py
23 1 0
def evaluate_disambiguation()
in model/utils/disambiguator_evaluation.py
21 8 3
def main()
in model/utils/response_evaluation.py
20 2 1
def _rotate_checkpoints()
in model/mm_dst/gpt2_dst/scripts/run_language_modeling.py
19 6 3
def initialize_count_dict()
in model/mm_dst/utils/evaluate_dst.py
18 1 0
def main()
in model/utils/disambiguator_evaluation.py
17 2 1
def load_and_cache_examples()
in model/mm_dst/gpt2_dst/scripts/run_language_modeling.py
16 7 3