facebookresearch / clevr-iep
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 98 units with 1,629 lines of code in units (88.1% of code).
    • 1 very long units (131 lines of code)
    • 4 long units (265 lines of code)
    • 19 medium size units (572 lines of code)
    • 29 small units (409 lines of code)
    • 45 very small units (252 lines of code)
8% | 16% | 35% | 25% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 16% | 35% | 25% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts18% | 30% | 38% | 7% | 6%
iep/models0% | 9% | 35% | 37% | 17%
iep0% | 0% | 28% | 40% | 30%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train_loop()
in scripts/train_model.py
131 22 3
def main()
in scripts/preprocess_questions.py
100 34 1
def get_baseline_model()
in scripts/train_model.py
59 8 1
def run_single_example()
in scripts/run_model.py
55 9 2
def __init__()
in iep/models/module_net.py
51 7 5
def main()
in scripts/train_model.py
46 6 1
def main()
in scripts/extract_features.py
43 9 1
def run_our_model_batch()
in scripts/run_model.py
39 4 5
def main()
in scripts/run_model.py
38 11 1
def check_accuracy()
in scripts/train_model.py
37 12 5
def __init__()
in iep/models/baselines.py
31 1 9
def __init__()
in iep/data.py
30 5 2
def __init__()
in iep/models/baselines.py
29 2 9
def build_classifier()
in iep/models/module_net.py
28 9 9
def _forward_modules_json()
in iep/models/module_net.py
28 2 3
def _forward_modules_ints_helper()
in iep/models/module_net.py
28 7 5
def __init__()
in iep/data.py
28 5 9
def reinforce_sample()
in iep/models/seq2seq.py
27 4 5
def run_baseline_batch()
in scripts/run_model.py
26 3 4
def __getitem__()
in iep/data.py
26 9 2