facebookresearch / SING
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 85 units with 1,018 lines of code in units (86.9% of code).
    • 1 very long units (144 lines of code)
    • 1 long units (59 lines of code)
    • 14 medium size units (425 lines of code)
    • 10 small units (150 lines of code)
    • 59 very small units (240 lines of code)
14% | 5% | 41% | 14% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py14% | 5% | 41% | 14% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sing36% | 14% | 36% | 3% | 9%
sing/sequence0% | 0% | 77% | 0% | 22%
sing/ae0% | 0% | 53% | 18% | 28%
sing/fondation0% | 0% | 25% | 33% | 41%
sing/nsynth0% | 0% | 31% | 34% | 34%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_parser()
in sing/parser.py
144 1 0
def main()
in sing/train.py
59 9 0
41 4 8
def __init__()
in sing/ae/models.py
40 3 9
def get_parser()
in sing/generate.py
40 1 0
def main()
in sing/generate.py
39 11 0
def __init__()
in sing/fondation/trainer.py
35 5 13
def __init__()
in sing/ae/models.py
29 3 8
def __init__()
in sing/ae/models.py
28 1 9
def make_datasets()
in sing/nsynth/__init__.py
28 7 4
def __init__()
in sing/sequence/models.py
28 3 7
def _train_batch()
in sing/sequence/trainer.py
27 4 2
def train_autoencoder()
in sing/train.py
24 4 2
def forward()
in sing/sequence/models.py
23 7 5
def generate_embeddings_dataset()
in sing/sequence/utils.py
22 6 5
def download_file()
in sing/fondation/utils.py
21 5 3
def __init__()
in sing/nsynth/__init__.py
20 8 2
def _train_epoch()
in sing/fondation/trainer.py
20 4 3
def _eval_dataset()
in sing/fondation/trainer.py
18 6 4
def train()
in sing/fondation/trainer.py
18 6 1