facebookresearch / radioactive_data
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 1,657 lines of code in units (81.8% of code).
    • 1 very long units (110 lines of code)
    • 5 long units (362 lines of code)
    • 16 medium size units (531 lines of code)
    • 23 small units (334 lines of code)
    • 67 very small units (320 lines of code)
6% | 21% | 32% | 20% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 21% | 32% | 20% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT21% | 44% | 30% | 0% | 3%
src0% | 17% | 39% | 23% | 19%
src/datasets0% | 0% | 14% | 44% | 40%
src/data_augmentations0% | 0% | 33% | 37% | 30%
src/model0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in make_data_radioactive.py
110 30 1
def main()
in train-logistic.py
81 16 1
def main()
in train-distillation.py
77 14 1
def main()
in train-classif.py
74 20 1
72 15 1
def get_optimizer()
in src/utils.py
58 21 2
def get_parser()
in train-distillation.py
50 1 0
def get_parser()
in train-logistic.py
49 1 0
48 14 6
def get_data_loader()
in src/dataset.py
42 18 6
def __init__()
in src/trainer.py
39 12 5
def __init__()
in src/datasets/folder.py
38 7 6
def sample_params()
in src/data_augmentations/__init__.py
33 10 3
def get_parser()
in train-classif.py
32 1 0
30 16 5
def get_parser()
in make_data_radioactive.py
29 1 0
def get_dump_path()
in src/utils.py
29 16 1
def initialize_exp()
in src/utils.py
24 3 1
def get_knn_faiss()
in src/utils.py
23 5 5
def create_logger()
in src/logger.py
22 7 2