facebookresearch / self_defeating_improvements
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 20 units with 367 lines of code in units (70.6% of code).
    • 1 very long units (112 lines of code)
    • 0 long units (0 lines of code)
    • 3 medium size units (95 lines of code)
    • 7 small units (111 lines of code)
    • 9 very small units (49 lines of code)
30% | 0% | 25% | 30% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py30% | 0% | 25% | 30% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
svhn_based_exp30% | 0% | 25% | 30% | 13%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_dataset()
in svhn_based_exp/utils.py
112 27 4
def test_epoch()
in svhn_based_exp/utils.py
35 5 6
def test_by_nn()
in svhn_based_exp/utils.py
33 4 5
def train_epoch()
in svhn_based_exp/utils.py
27 4 7
def set_logger()
in svhn_based_exp/logger.py
18 4 3
def construct_tensor_dataset()
in svhn_based_exp/utils.py
18 5 6
def get_upstream_model()
in svhn_based_exp/utils.py
18 5 4
def get_model()
in svhn_based_exp/utils.py
17 10 4
def get_upstream_preprocessing()
in svhn_based_exp/utils.py
17 2 5
def split_test_val()
in svhn_based_exp/utils.py
12 1 1
def get_repre()
in svhn_based_exp/utils.py
11 3 3
def get_num_classes()
in svhn_based_exp/utils.py
10 5 1
def __init__()
in svhn_based_exp/models.py
7 1 2
def forward()
in svhn_based_exp/models.py
6 1 2
def get_criterion()
in svhn_based_exp/utils.py
6 2 1
def get_dist()
in svhn_based_exp/utils.py
6 3 3
def __init__()
in svhn_based_exp/models.py
5 2 4
def forward()
in svhn_based_exp/models.py
4 2 2
def get_output_from_model()
in svhn_based_exp/utils.py
3 1 5
def get_logger()
in svhn_based_exp/logger.py
2 1 1