amazon-research / transformer-gan
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 198 units with 3,887 lines of code in units (75.2% of code).
    • 5 very long units (1,240 lines of code)
    • 8 long units (477 lines of code)
    • 30 medium size units (988 lines of code)
    • 48 small units (686 lines of code)
    • 107 very small units (496 lines of code)
31% | 12% | 25% | 17% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py31% | 12% | 25% | 17% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
model38% | 14% | 20% | 14% | 12%
BERT69% | 0% | 18% | 8% | 3%
model/utils0% | 14% | 47% | 22% | 15%
metrics0% | 39% | 48% | 0% | 11%
data0% | 0% | 0% | 62% | 37%
ROOT0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in model/train.py
376 94 0
def main()
in BERT/main.py
276 47 0
def main()
in model/generate.py
227 69 1
def forward()
in model/transformer_gan.py
210 73 8
def train()
in BERT/main.py
151 56 4
def _forward()
in model/mem_transformer.py
71 16 5
def iterator()
in model/data_utils.py
64 19 0
def forward()
in model/utils/proj_adaptive_softmax.py
62 13 4
def __init__()
in model/data_utils.py
60 13 3
def forward()
in model/mem_transformer.py
60 11 7
def evaluate()
in model/train.py
58 20 4
def discriminator()
in model/utils/config_helper.py
51 15 1
def main()
in metrics/bert_score.py
51 4 0
def __init__()
in BERT/main.py
50 12 5
def get_score()
in model/utils/classifier.py
50 8 1
def __init__()
in model/transformer_gan.py
49 8 3
def evaluate()
in BERT/main.py
42 8 4
def get_losses()
in model/utils/helpers.py
41 12 3
def get_bert_embedding()
in metrics/bert_score.py
39 6 5
def weights_init()
in model/train.py
38 29 1