facebookresearch / online_dialog_eval
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 242 units with 3,928 lines of code in units (85.9% of code).
    • 2 very long units (533 lines of code)
    • 9 long units (581 lines of code)
    • 40 medium size units (1,313 lines of code)
    • 52 small units (743 lines of code)
    • 139 very small units (758 lines of code)
13% | 14% | 33% | 18% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 14% | 33% | 18% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT22% | 10% | 31% | 15% | 20%
scripts50% | 23% | 9% | 11% | 5%
codes0% | 18% | 46% | 16% | 17%
backup0% | 25% | 29% | 27% | 17%
backup/baselines/ruber0% | 0% | 46% | 32% | 20%
logbook0% | 0% | 16% | 19% | 64%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_args()
in args.py
335 2 1
def prepare_corruptions()
in scripts/compute_corrupt.py
198 51 3
def main()
in scripts/interactive_file.py
91 31 1
85 24 3
67 18 1
def preflight_steps()
in codes/models.py
61 10 1
def get_dataloader()
in codes/net.py
61 14 3
def __init__()
in codes/models.py
58 8 3
def semantic_cluster()
in backup/analysis.py
54 10 1
def forward()
in backup/models.py
53 2 4
def forward()
in backup/models.py
51 2 4
def train()
in backup/baselines/ruber/train_word2vec.py
50 7 1
def test_step()
in codes/net.py
48 6 3
def training_step()
in codes/net.py
47 9 3
def train_epoch()
in backup/train.py
47 5 2
46 36 2
def validation_step()
in codes/net.py
45 6 3
def train_epoch()
in backup/baselines/ruber/train.py
44 4 2
43 14 3
def forward()
in backup/ablation_models.py
42 1 4