facebookresearch / multihop_dense_retrieval
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 304 units with 5,142 lines of code in units (78.3% of code).
    • 7 very long units (1,017 lines of code)
    • 10 long units (663 lines of code)
    • 52 medium size units (1,652 lines of code)
    • 62 small units (945 lines of code)
    • 173 very small units (865 lines of code)
19% | 12% | 32% | 18% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py19% | 12% | 32% | 18% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts72% | 10% | 7% | 8% | 1%
mdr/qa17% | 19% | 29% | 18% | 14%
mdr/retrieval17% | 26% | 39% | 6% | 9%
submitit0% | 42% | 35% | 0% | 21%
mdr/retrieval/data0% | 0% | 66% | 19% | 13%
mdr/retrieval/utils0% | 0% | 26% | 42% | 30%
mdr/retrieval/models0% | 0% | 0% | 34% | 65%
scripts/eval0% | 0% | 0% | 57% | 42%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in scripts/train_momentum.py
159 39 0
def main()
in mdr/retrieval/train_single.py
152 40 0
def main()
in scripts/train_mhop.py
152 38 0
def main()
in scripts/train_qa.py
152 39 0
def main()
in mdr/qa/train_ranker.py
146 38 0
def predict()
in scripts/train_qa.py
137 19 5
def _eval()
in mdr/qa/qa_trainer.py
119 12 1
def __init__()
in mdr/qa/qa_dataset.py
95 30 7
def eval_final()
in scripts/train_qa.py
83 12 5
def _train()
in mdr/qa/qa_trainer.py
69 16 1
def __getitem__()
in mdr/qa/qa_dataset.py
69 25 2
def _train()
in mdr/retrieval/single_trainer.py
63 9 1
def _init_state()
in mdr/qa/qa_trainer.py
61 11 1
def grid_search()
in submitit/submitit_train_qa.py
59 7 1
def _init_state()
in mdr/retrieval/mhop_trainer.py
57 11 1
def _train()
in mdr/retrieval/mhop_trainer.py
56 9 1
def _init_state()
in mdr/retrieval/single_trainer.py
51 10 1
def grid_search()
in submitit/submitit_train.py
50 7 1
def get_final_text()
in mdr/qa/utils.py
50 19 4
def prepare()
in mdr/qa/qa_dataset.py
50 10 5