facebookresearch / UNLU
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 324 units with 6,366 lines of code in units (65.5% of code).
    • 10 very long units (2,371 lines of code)
    • 7 long units (465 lines of code)
    • 40 medium size units (1,247 lines of code)
    • 91 small units (1,301 lines of code)
    • 176 very small units (982 lines of code)
37% | 7% | 19% | 20% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py37% | 7% | 19% | 20% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
anli/src64% | 0% | 10% | 18% | 6%
codes/rnn_training54% | 30% | 3% | 10% | 1%
anli95% | 0% | 0% | 0% | 4%
codes0% | 13% | 30% | 19% | 36%
infersent_comp0% | 14% | 37% | 26% | 21%
infersent_comp/encoder0% | 0% | 42% | 37% | 20%
dataset_utils/mnli0% | 0% | 57% | 0% | 42%
dataset_utils/ocnli0% | 0% | 86% | 0% | 13%
utils0% | 0% | 23% | 40% | 35%
dataset_utils/snli0% | 0% | 0% | 44% | 55%
ROOT0% | 0% | 0% | 89% | 10%
dataset_utils0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in anli/src/nli/train_with_scramble.py
505 56 2
def train()
in anli/src/nli/training.py
425 49 2
def train()
in anli/src/nli/train_with_confidence.py
344 54 2
def HyperEvaluate()
in codes/rnn_training/train_nli_ray.py
209 14 1
def HyperEvaluate()
in codes/rnn_training/train_nli_w2v.py
175 14 1
def main()
in anli/run_causal_lm.py
167 35 3
def get_args()
in anli/src/nli/train_with_scramble.py
149 1 0
def get_args()
in anli/src/nli/train_with_confidence.py
141 1 0
def get_args()
in anli/src/nli/training.py
141 1 0
def evaluation()
in anli/src/nli/evaluation.py
115 17 1
def HyperEvaluate()
in codes/rnn_training/Non_transformers_probe.py
82 7 1
def print_stats()
in codes/word_randomization.py
82 6 3
def trainepoch()
in codes/rnn_training/train_nli_ray.py
66 10 6
def trainepoch()
in codes/rnn_training/train_nli_w2v.py
65 10 6
def trainepoch()
in infersent_comp/train_nli.py
60 10 1
def get_model_args()
in codes/rnn_models.py
59 1 0
def evaluate()
in infersent_comp/train_nli.py
51 19 3
def get_args()
in anli/src/nli/evaluation.py
50 1 0
def inference()
in anli/src/nli/inference_debug.py
48 7 6
def __init__()
in codes/rnn_models.py
48 7 2