facebookresearch / dpr-scale
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 176 units with 1,825 lines of code in units (58.7% of code).
    • 0 very long units (0 lines of code)
    • 4 long units (266 lines of code)
    • 18 medium size units (531 lines of code)
    • 27 small units (394 lines of code)
    • 127 very small units (634 lines of code)
0% | 14% | 29% | 21% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 14% | 29% | 21% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
dpr_scale/transforms0% | 70% | 0% | 12% | 17%
dpr_scale/optim0% | 70% | 0% | 0% | 29%
dpr_scale/task0% | 22% | 30% | 15% | 32%
dpr_scale0% | 0% | 51% | 24% | 24%
dpr_scale/utils0% | 0% | 19% | 29% | 50%
dpr_scale/data_prep0% | 0% | 50% | 14% | 35%
dpr_scale/datamodule0% | 0% | 14% | 30% | 55%
dpr_scale/models0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in dpr_scale/transforms/dpr_transform.py
73 22 3
def forward()
in dpr_scale/transforms/dpr_transform.py
70 23 3
def step()
in dpr_scale/optim/madgrad.py
66 12 3
def _eval_epoch_end()
in dpr_scale/task/dpr_task.py
57 8 3
def main()
in dpr_scale/run_retrieval_multiset.py
43 5 2
def main()
in dpr_scale/msmarco_eval.py
41 7 0
def main()
in dpr_scale/run_retrieval.py
39 4 1
def get_parser()
in dpr_scale/run_retrieval_fb.py
34 1 0
def main()
in dpr_scale/run_retrieval_fb.py
34 4 2
def get_parser()
in dpr_scale/run_retrieval_multiset.py
32 1 0
def training_step()
in dpr_scale/task/dpr_task.py
32 5 3
def evaluate_retrieval()
in dpr_scale/eval_dpr.py
30 7 4
def __iter__()
in dpr_scale/utils/utils.py
28 5 1
def get_parser()
in dpr_scale/utils/prep_wiki_exp.py
28 1 0
def configure_optimizers()
in dpr_scale/task/dpr_task.py
27 3 1
def prep_dpr_ubuntuv2()
in dpr_scale/data_prep/prep_conv_datasets.py
26 4 2
def main()
in dpr_scale/main.py
26 3 1
def main()
in dpr_scale/utils/ccnews_stats.py
23 4 2
def prep_dpr_dstc7()
in dpr_scale/data_prep/prep_conv_datasets.py
23 3 2
def __init__()
in dpr_scale/datamodule/dpr.py
22 4 17