facebookresearch / taskmodularnets
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 54 units with 907 lines of code in units (67.6% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (272 lines of code)
    • 10 medium size units (297 lines of code)
    • 11 small units (180 lines of code)
    • 30 very small units (158 lines of code)
0% | 29% | 32% | 19% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 29% | 32% | 19% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
archs0% | 34% | 34% | 18% | 12%
ROOT0% | 66% | 28% | 0% | 4%
utils0% | 0% | 58% | 0% | 41%
data0% | 0% | 15% | 55% | 28%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def test()
in train_modular.py
97 12 1
def __init__()
in archs/models.py
88 11 9
def forward()
in archs/models.py
87 24 5
def train()
in train_modular.py
42 9 1
def train_forward_softmax()
in archs/models.py
36 1 2
def val_forward()
in archs/models.py
36 5 2
33 7 2
def __init__()
in archs/models.py
33 16 3
def evaluate_predictions()
in archs/models.py
26 6 5
def __getitem__()
in data/dataset.py
25 6 2
def calc_pr_ovr_noref()
in utils/utils.py
23 6 2
def __init__()
in archs/models.py
22 4 6
def forward()
in archs/models.py
21 8 4
def generate_predictions()
in archs/models.py
20 3 3
def __init__()
in archs/models.py
19 5 5
def parse_split()
in data/dataset.py
19 2 1
def generate_features()
in data/dataset.py
19 2 2
def imagenet_transform()
in data/dataset.py
17 4 1
def get_split_info()
in data/dataset.py
17 7 1
def reset_dropout()
in data/dataset.py
16 4 1