facebookresearch / uimnet
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 378 units with 3,966 lines of code in units (49.2% of code).
    • 0 very long units (0 lines of code)
    • 8 long units (568 lines of code)
    • 33 medium size units (993 lines of code)
    • 80 small units (1,109 lines of code)
    • 257 very small units (1,296 lines of code)
0% | 14% | 25% | 27% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 14% | 25% | 27% | 32%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
uimnet/workers0% | 57% | 21% | 7% | 13%
scripts0% | 7% | 34% | 25% | 32%
uimnet/metrics0% | 35% | 0% | 29% | 35%
uimnet/algorithms0% | 0% | 33% | 39% | 27%
uimnet/modules0% | 0% | 36% | 23% | 40%
uimnet/utils0% | 0% | 9% | 42% | 48%
uimnet/measures0% | 0% | 23% | 18% | 58%
uimnet/evaluation0% | 0% | 21% | 49% | 28%
benchmarks0% | 0% | 80% | 0% | 19%
profiles0% | 0% | 77% | 0% | 22%
uimnet/datasets0% | 0% | 11% | 45% | 42%
uimnet/ensembles0% | 0% | 21% | 13% | 65%
uimnet/numerics0% | 0% | 0% | 61% | 38%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __call__()
in uimnet/workers/calibrator.py
88 13 5
def __call__()
in uimnet/workers/evaluator.py
86 18 7
def __call__()
in uimnet/workers/evaluator2.py
83 18 7
def __call__()
in uimnet/workers/predictor.py
73 8 6
def __call__()
in uimnet/workers/mog.py
67 13 5
def run_ensembles()
in scripts/run_ensembles.py
64 12 5
def maybe_setup_distributed()
in uimnet/workers/base.py
54 12 2
def __call__()
in uimnet/metrics/fused_prediction.py
53 5 3
def __call__()
in uimnet/workers/trainer.py
49 9 4
def run_evaluation()
in scripts/run_evaluation.py
49 13 5
def run_training()
in scripts/run_training.py
49 4 6
def monkey_patch_layers()
in uimnet/modules/spectral_normalization/utils.py
44 8 4
def run_prediction()
in scripts/run_prediction.py
44 7 2
def run_calibration()
in scripts/run_calibration.py
41 8 2
def __init__()
in uimnet/algorithms/due.py
36 6 5
def construct_networks()
in uimnet/algorithms/due.py
33 5 2
def estimate()
in uimnet/measures/mog.py
32 7 2
def forward()
in uimnet/modules/spectral_normalization/spectral_bn.py
32 17 2
def _collect_oodomain_records()
in uimnet/evaluation/oodomain.py
31 9 2
def __call__()
in uimnet/workers/embeddings_extractor.py
31 7 4