amazon-research / contextual-attention-nlm
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 90 units with 1,029 lines of code in units (88.1% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (93 lines of code)
    • 13 medium size units (390 lines of code)
    • 17 small units (241 lines of code)
    • 59 very small units (305 lines of code)
0% | 9% | 37% | 23% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 9% | 37% | 23% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT0% | 53% | 19% | 17% | 9%
src0% | 0% | 41% | 24% | 33%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in run_model.py
93 14 1
def __init__()
in src/model.py
45 9 3
def forward()
in src/model.py
43 10 2
def __init__()
in src/model.py
36 8 4
def custom_collate()
in src/data.py
34 9 1
def main()
in run_inference.py
34 1 1
def forward()
in src/model.py
27 6 3
26 5 1
def forward()
in src/model.py
26 6 3
def __init__()
in src/model.py
25 5 4
def init_concat_lstm()
in src/model.py
25 3 2
25 3 2
def forward()
in src/model.py
23 3 2
def get_tokenizer()
in src/tokenizer.py
21 5 5
def forward()
in src/model.py
20 5 3
def init_base_lstm()
in src/model.py
20 5 2
def _run_cell()
in src/model.py
17 2 8
def _process_data_files()
in src/tokenizer.py
16 3 2
def _generate_model()
in src/tokenizer.py
16 2 1
16 2 9