facebookresearch / recipes
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 219 units with 1,375 lines of code in units (36.8% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 7 medium size units (169 lines of code)
    • 24 small units (338 lines of code)
    • 188 very small units (868 lines of code)
0% | 0% | 12% | 24% | 63%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 12% | 24% | 63%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
torchrecipes/vision/image_generation0% | 0% | 27% | 14% | 58%
torchrecipes/audio/source_separation0% | 0% | 19% | 17% | 63%
torchrecipes/core0% | 0% | 23% | 11% | 65%
torchrecipes/vision/data0% | 0% | 0% | 40% | 59%
torchrecipes/text/doc_classification0% | 0% | 0% | 44% | 55%
torchrecipes/vision/image_classification0% | 0% | 0% | 27% | 72%
torchrecipes/utils0% | 0% | 0% | 37% | 62%
ROOT0% | 0% | 0% | 51% | 48%
torchrecipes/vision/core0% | 0% | 0% | 0% | 100%
torchrecipes/launcher0% | 0% | 0% | 0% | 100%
torchrecipes0% | 0% | 0% | 0% | 100%
torchrecipes/checkpointing0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def setup()
in torchrecipes/audio/source_separation/datamodule/librimix.py
27 8 2
def train()
in torchrecipes/core/base_train_app.py
25 4 1
def info_loss_step()
in torchrecipes/vision/image_generation/module/infogan.py
25 2 1
def generate_sample_image()
in torchrecipes/vision/image_generation/module/infogan.py
25 2 2
def on_epoch_end()
in torchrecipes/vision/image_generation/callbacks/image_generation.py
24 3 3
def get_callbacks()
in torchrecipes/audio/source_separation/train_app.py
22 1 1
def generator_step()
in torchrecipes/vision/image_generation/module/infogan.py
21 2 1
def get_lightning_module()
in torchrecipes/vision/image_classification/train_app.py
20 2 1
20 3 0
def get_lightning_module()
in torchrecipes/audio/source_separation/train_app.py
19 2 1
def _get_data_loader()
in torchrecipes/text/doc_classification/datamodule/doc_classification.py
19 1 3
def configure_optimizers()
in torchrecipes/vision/image_generation/module/infogan.py
18 1 1
def update()
in torchrecipes/vision/image_classification/metrics/multilabel_accuracy.py
18 1 3
def get_lightning_module()
in torchrecipes/text/doc_classification/train_app.py
17 3 1
def __init__()
in torchrecipes/vision/data/modules/mnist_data_module.py
14 1 0
def setup()
in torchrecipes/vision/data/modules/mnist_data_module.py
14 5 2
def __call__()
in torchrecipes/audio/source_separation/datamodule/utils.py
14 4 2
def get_data_module()
in torchrecipes/text/doc_classification/train_app.py
14 3 1
def get_class_config_method()
in torchrecipes/utils/config_utils.py
13 5 1
def _get_data_loader()
in torchrecipes/vision/data/modules/torchvision_data_module.py
13 2 3