amazon-research / read-up
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 549 units with 8,853 lines of code in units (72.5% of code).
    • 4 very long units (476 lines of code)
    • 24 long units (1,557 lines of code)
    • 121 medium size units (3,678 lines of code)
    • 99 small units (1,475 lines of code)
    • 301 very small units (1,667 lines of code)
5% | 17% | 41% | 16% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 17% | 41% | 16% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/model/vilbert17% | 11% | 18% | 17% | 35%
src/model5% | 44% | 25% | 15% | 9%
solver0% | 7% | 61% | 20% | 10%
src/data0% | 11% | 60% | 10% | 18%
ROOT0% | 95% | 0% | 0% | 4%
src/tools0% | 0% | 30% | 24% | 45%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def from_pretrained()
in src/model/vilbert/utils.py
136 37 4
def ForwardModelsVal()
in src/model/vilbert/task_utils.py
120 14 7
def LoadDatasets()
in src/model/vilbert/task_utils.py
115 16 4
def play()
in src/model/self_play_all_vilbert.py
105 16 21
def play()
in src/model/self_play_qgen_vdst_oracle_vilbert_guesser_vilbert.py
95 16 20
def run()
in main.py
92 21 1
def play()
in src/model/self_play_qgen_vdst_guesser_vilbert.py
86 16 19
def __getitem__()
in src/data/image_features_reader.py
85 4 2
def play_with_gt_questions()
in src/model/self_play_all_vilbert.py
78 11 18
def play_with_gt_questions()
in src/model/self_play_qgen_vdst_oracle_vilbert_guesser_vilbert.py
78 11 18
def play_with_gt_questions()
in src/model/self_play_qgen_vdst_guesser_vilbert.py
78 11 18
def play()
in src/model/self_play_qgen_vdst_oracle_vilbert.py
76 12 19
def LoadDatasetEval()
in src/model/vilbert/task_utils.py
75 11 3
def play_with_gt_questions()
in src/model/self_play_qgen_vdst_oracle_vilbert.py
65 13 17
def step()
in src/model/vilbert/optimization.py
60 9 2
def play()
in src/model/self_play_qgen_vilbert.py
59 13 18
def validate()
in solver/oracle_vilbert.py
55 11 4
def load_tf_weights_in_bert()
in src/model/vilbert/vilbert.py
55 20 2
def forward_turn()
in src/model/guesser_vilbert.py
54 4 17
def forward_turn()
in src/model/qgen_vilbert.py
54 4 17