facebookresearch / FiD
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 104 units with 1,306 lines of code in units (75.8% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (188 lines of code)
    • 15 medium size units (410 lines of code)
    • 27 small units (394 lines of code)
    • 59 very small units (314 lines of code)
0% | 14% | 31% | 30% | 24%
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% | 31% | 30% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT0% | 35% | 41% | 13% | 8%
src0% | 6% | 27% | 36% | 29%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in train_retriever.py
68 17 9
def train()
in train_reader.py
60 13 10
60 18 1
46 9 10
def main()
in passage_retrieval.py
38 6 1
def evaluate()
in train_retriever.py
35 8 4
def forward()
in src/model.py
32 2 6
def evaluate()
in train_reader.py
29 4 5
def select_examples_TQA()
in src/preprocess.py
26 4 4
def main()
in generate_passage_embeddings.py
25 3 1
def embed_passages()
in generate_passage_embeddings.py
24 5 4
23 4 2
def __call__()
in src/data.py
23 8 2
def __call__()
in src/data.py
23 7 2
def forward()
in src/model.py
22 9 5
def load_data()
in src/data.py
22 13 3
def load()
in src/util.py
21 3 4
def __getitem__()
in src/data.py
21 6 2
def embed_questions()
in passage_retrieval.py
20 2 4
def embed_text()
in src/model.py
20 6 5