awslabs / mlm-scoring
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 98 units with 1,584 lines of code in units (83.2% of code).
    • 1 very long units (147 lines of code)
    • 4 long units (315 lines of code)
    • 18 medium size units (494 lines of code)
    • 24 small units (344 lines of code)
    • 51 very small units (284 lines of code)
9% | 19% | 31% | 21% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 19% | 31% | 21% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/mlm/models38% | 0% | 29% | 22% | 9%
src/mlm0% | 26% | 31% | 21% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_pretrained()
in src/mlm/models/__init__.py
147 36 8
def main()
in src/mlm/cmds.py
97 1 0
def score()
in src/mlm/scorers.py
89 6 6
def score()
in src/mlm/scorers.py
72 6 7
def cmd_score()
in src/mlm/cmds.py
57 18 1
def bin()
in src/mlm/scorers.py
49 18 6
def forward()
in src/mlm/models/gpt2.py
38 4 3
def score()
in src/mlm/scorers.py
36 14 7
def corpus_to_dataset()
in src/mlm/scorers.py
33 9 2
def cmd_rescore()
in src/mlm/cmds.py
29 5 1
def __init__()
in src/mlm/models/gpt2.py
28 2 9
def from_nmt()
in src/mlm/loaders.py
27 7 5
def _pad_arrs_to_max_length()
in src/mlm/batchify.py
27 14 6
def forward()
in src/mlm/models/gpt2.py
26 4 3
def cmd_bin()
in src/mlm/cmds.py
26 8 1
def __init__()
in src/mlm/batchify.py
24 10 6
def _batch_ops()
in src/mlm/scorers.py
23 10 6
def _batch_ops()
in src/mlm/scorers.py
23 4 5
def from_dict()
in src/mlm/loaders.py
21 8 7
def bin()
in src/mlm/scorers.py
21 6 6