facebookresearch / agem
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 112 units with 4,831 lines of code in units (92.8% of code).
    • 11 very long units (2,397 lines of code)
    • 10 long units (690 lines of code)
    • 34 medium size units (1,230 lines of code)
    • 20 small units (285 lines of code)
    • 37 very small units (229 lines of code)
49% | 14% | 25% | 5% | 4%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py49% | 14% | 25% | 5% | 4%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT72% | 12% | 11% | 2% | 1%
model14% | 27% | 43% | 6% | 8%
utils0% | 9% | 58% | 18% | 13%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train_task_sequence()
in conv_split_cub_hybrid.py
342 65 17
def train_task_sequence()
in conv_split_cub.py
328 63 15
def train_task_sequence()
in conv_split_awa_hybrid.py
310 95 17
def train_task_sequence()
in conv_split_awa.py
303 92 15
def train_task_sequence()
in conv_split_cifar.py
287 50 4
def train_task_sequence()
in fc_permute_mnist.py
182 59 3
def main()
in conv_split_awa_hybrid.py
138 46 0
def main()
in conv_split_cub_hybrid.py
137 47 0
def main()
in conv_split_awa.py
130 46 0
def main()
in conv_split_cub.py
128 45 0
112 49 3
def _get_cifar()
in utils/data_utils.py
86 6 2
81 28 3
def main()
in fc_permute_mnist.py
78 22 0
def main()
in conv_split_cifar.py
78 21 0
68 8 6
def test_task_sequence()
in conv_split_awa_hybrid.py
67 13 8
def __init__()
in model/model.py
67 19 13
def test_task_sequence()
in conv_split_awa.py
61 13 6
def get_arguments()
in conv_split_awa_hybrid.py
52 1 0