facebookresearch / augmentation-corruption
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 533 units with 5,781 lines of code in units (79.4% of code).
    • 0 very long units (0 lines of code)
    • 14 long units (969 lines of code)
    • 61 medium size units (1,805 lines of code)
    • 78 small units (1,229 lines of code)
    • 380 very small units (1,778 lines of code)
0% | 16% | 31% | 21% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 16% | 31% | 21% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
experiments0% | 57% | 32% | 8% | 1%
experiments/overlap0% | 18% | 41% | 18% | 21%
experiments/tools0% | 60% | 13% | 21% | 5%
experiments/overlap/augmentations0% | 2% | 24% | 26% | 46%
imagenet_c_bar0% | 5% | 33% | 25% | 36%
notebook_utils0% | 0% | 66% | 11% | 21%
imagenet_c_bar/utils0% | 0% | 25% | 34% | 39%
experiments/overlap/utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in experiments/tools/summarize.py
100 32 0
def train()
in experiments/closest_augs.py
91 17 1
def train()
in experiments/severity_scan_imagenet.py
84 11 2
def train()
in experiments/severity_scan.py
81 10 2
def train_net()
in experiments/overlap/train_net_jsd.py
80 20 15
def train_net()
in experiments/overlap/train_net.py
78 20 13
def train()
in experiments/feature_corrupt_error.py
73 5 1
def extract_features()
in experiments/overlap/extract_features.py
64 24 9
def sample_matched_corruptions()
in experiments/sample_datasets.py
55 17 4
def build_sets()
in experiments/sample_datasets.py
53 15 2
def train()
in experiments/train_imagenet_jsd.py
53 4 2
def transform()
in experiments/overlap/augmentations/distortion.py
53 11 8
def transform()
in imagenet_c_bar/corrupt.py
53 11 8
def train()
in experiments/train_imagenet.py
51 4 2
def spatter()
in experiments/overlap/augmentations/imagenetc.py
47 3 4
def main()
in experiments/sample_datasets.py
43 6 0
def main()
in imagenet_c_bar/make_imagenet_c_bar.py
41 8 0
def main()
in imagenet_c_bar/make_cifar10_c_bar.py
41 6 0
def build_corr_tables()
in experiments/sample_datasets.py
40 5 3
def __init__()
in experiments/overlap/datasets.py
40 3 9