facebookresearch / DrQA
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 196 units with 2,331 lines of code in units (69.5% of code).
    • 0 very long units (0 lines of code)
    • 5 long units (372 lines of code)
    • 29 medium size units (845 lines of code)
    • 37 small units (532 lines of code)
    • 125 very small units (582 lines of code)
0% | 15% | 36% | 22% | 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% | 15% | 36% | 22% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts/reader0% | 41% | 38% | 14% | 5%
drqa/pipeline0% | 58% | 0% | 27% | 14%
drqa/reader0% | 5% | 48% | 22% | 22%
scripts/distant0% | 45% | 28% | 12% | 14%
drqa/tokenizers0% | 0% | 39% | 29% | 31%
scripts/pipeline0% | 0% | 95% | 0% | 4%
scripts/retriever0% | 0% | 17% | 41% | 41%
drqa/retriever0% | 0% | 0% | 23% | 76%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in scripts/reader/train.py
100 18 1
def process_batch()
in drqa/pipeline/drqa.py
93 11 6
def add_train_args()
in scripts/reader/train.py
65 1 1
def find_answer()
in scripts/distant/generate.py
57 21 4
def add_model_args()
in drqa/reader/config.py
57 1 1
def __init__()
in drqa/reader/rnn_reader.py
50 9 3
def vectorize()
in drqa/reader/vector.py
46 28 3
def set_defaults()
in scripts/reader/train.py
41 17 1
def process_dataset()
in scripts/reader/preprocess.py
40 5 3
def predict_batch()
in drqa/reader/predictor.py
39 13 3
def batchify()
in drqa/reader/vector.py
38 19 1
def _forward_padded()
in drqa/reader/layers.py
36 11 3
def process()
in scripts/distant/generate.py
35 7 4
def decode_candidates()
in drqa/reader/model.py
33 10 5
def tokenize()
in drqa/tokenizers/corenlp_tokenizer.py
32 7 2
def get_count_matrix()
in scripts/retriever/build_tfidf.py
31 5 3
def tokenize()
in drqa/tokenizers/regexp_tokenizer.py
31 12 2
def load_embeddings()
in drqa/reader/model.py
29 10 3
def __init__()
in drqa/reader/predictor.py
25 6 6
def validate_official()
in scripts/reader/train.py
24 3 7