facebookresearch / EmpatheticDialogues
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 70 units with 1,234 lines of code in units (62.8% of code).
    • 1 very long units (167 lines of code)
    • 2 long units (168 lines of code)
    • 12 medium size units (400 lines of code)
    • 22 small units (317 lines of code)
    • 33 very small units (182 lines of code)
13% | 13% | 32% | 25% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 13% | 32% | 25% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
empchat34% | 0% | 32% | 24% | 8%
ROOT0% | 50% | 22% | 14% | 12%
empchat/datasets0% | 0% | 40% | 36% | 23%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_parser()
in empchat/util.py
167 1 0
def get_bleu4()
in retrieval_eval_bleu.py
85 12 2
def train_model()
in retrieval_train.py
83 24 1
def read_dailydialog_data()
in empchat/datasets/dailydialog.py
41 4 2
def __init__()
in empchat/bert_local.py
40 6 3
def train()
in retrieval_train.py
39 7 6
def build_bert_dictionary()
in empchat/datasets/loader.py
39 10 1
def forward()
in empchat/transformer_local.py
37 1 3
def build_valid_dataloader()
in empchat/datasets/loader.py
35 6 3
def main()
in retrieval_train.py
34 3 1
def build_train_dataloader()
in empchat/datasets/loader.py
33 3 2
def __init__()
in empchat/transformer_local.py
28 3 3
def load_embeddings()
in empchat/models.py
27 5 3
def forward()
in empchat/bert_local.py
24 5 3
def __init__()
in empchat/datasets/loader.py
23 10 3
def predict()
in retrieval_eval_bleu.py
19 5 3
def get_bert_token_mapping()
in empchat/datasets/tokens.py
18 3 1
def forward()
in empchat/transformer_local.py
18 3 3
def load()
in empchat/models.py
17 5 2
def get_logger()
in empchat/util.py
17 2 1