facebookresearch / BLINK
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 285 units with 4,720 lines of code in units (49.5% of code).
    • 5 very long units (978 lines of code)
    • 13 long units (910 lines of code)
    • 40 medium size units (1,244 lines of code)
    • 51 small units (709 lines of code)
    • 176 very small units (879 lines of code)
20% | 19% | 26% | 15% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py20% | 19% | 26% | 15% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
elq/biencoder38% | 0% | 24% | 17% | 19%
blink/candidate_ranking35% | 16% | 19% | 9% | 18%
blink/crossencoder47% | 15% | 8% | 10% | 18%
blink/biencoder30% | 15% | 9% | 14% | 30%
elq/common42% | 29% | 25% | 0% | 2%
blink/candidate_retrieval0% | 42% | 30% | 17% | 9%
blink/common0% | 49% | 36% | 8% | 4%
scripts0% | 35% | 0% | 56% | 8%
blink0% | 12% | 48% | 21% | 18%
elq0% | 0% | 57% | 18% | 24%
elq/vcg_utils0% | 0% | 100% | 0% | 0%
blink/indexer0% | 0% | 37% | 0% | 62%
elq/candidate_ranking0% | 0% | 42% | 0% | 57%
elq/index0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in elq/biencoder/train_biencoder.py
303 31 1
def main()
in blink/candidate_ranking/train.py
202 16 1
def main()
in blink/crossencoder/train_cross.py
180 17 1
def main()
in blink/biencoder/train_biencoder.py
150 15 1
def add_training_args()
in elq/common/params.py
143 1 2
def add_model_args()
in elq/common/params.py
100 1 2
def evaluate()
in blink/candidate_ranking/evaluate.py
96 9 2
def get_list_of_mentions()
in blink/candidate_retrieval/utils.py
80 9 1
def main()
in blink/biencoder/eval_biencoder.py
75 8 1
def add_model_args()
in blink/common/params.py
70 1 2
def extract_questions()
in scripts/create_BLINK_benchmark_data.py
69 16 1
def main()
in blink/candidate_retrieval/perform_and_evaluate_candidate_retrieval_multithreaded.py
66 11 1
def add_training_args()
in blink/common/params.py
65 1 2
def main()
in blink/main_solr.py
65 12 1
def evaluate()
in blink/crossencoder/train_cross.py
59 14 7
def read_conll_file()
in blink/candidate_retrieval/dataset.py
57 10 2
def get_datasets()
in blink/candidate_retrieval/utils.py
56 8 2
def __init__()
in blink/candidate_retrieval/dataset.py
52 5 5
def load_models()
in elq/main_dense.py
49 4 2
def read_csv_file()
in blink/candidate_retrieval/dataset.py
47 4 2