facebookresearch / contriever
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 18 units with 313 lines of code in units (77.1% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (92 lines of code)
    • 4 medium size units (126 lines of code)
    • 3 small units (43 lines of code)
    • 10 very small units (52 lines of code)
0% | 29% | 40% | 13% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 29% | 40% | 13% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 32% | 33% | 15% | 18%
ROOT0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 18 longest units
Unit# linesMcCabe index# params
def evaluate_model()
in src/beir_utils.py
92 23 12
35 12 1
def encode_corpus()
in src/beir_utils.py
32 7 5
def main()
in eval_beir.py
30 3 1
def encode_queries()
in src/beir_utils.py
29 5 4
def varsize_gather_nograd()
in src/dist_utils.py
17 5 1
def forward()
in src/contriever.py
13 1 0
def init_logger()
in src/utils.py
13 3 1
def sig_handler()
in src/slurm.py
10 2 2
def __init__()
in src/beir_utils.py
10 1 0
def gather_nograd()
in src/dist_utils.py
6 2 1
def is_main()
in src/dist_utils.py
6 3 0
def forward()
in src/dist_utils.py
4 2 1
def backward()
in src/dist_utils.py
4 1 1
def gather()
in src/dist_utils.py
4 1 1
def term_handler()
in src/slurm.py
3 1 2
3 1 0
def __init__()
in src/contriever.py
2 1 3