facebookresearch / MultipleAttributeTextRewriting
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 243 units with 3,962 lines of code in units (73.7% of code).
    • 2 very long units (405 lines of code)
    • 11 long units (666 lines of code)
    • 42 medium size units (1,315 lines of code)
    • 54 small units (855 lines of code)
    • 134 very small units (721 lines of code)
10% | 16% | 33% | 21% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 16% | 33% | 21% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
code/src20% | 3% | 32% | 24% | 19%
code/src/model0% | 34% | 37% | 16% | 10%
code/src/modules0% | 32% | 9% | 39% | 19%
code/src/data0% | 17% | 42% | 14% | 26%
code/scripts0% | 0% | 0% | 0% | 100%
data0% | 0% | 0% | 0% | 100%
code0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def generate()
in code/src/sequence_generator.py
238 47 7
def eval_swap_bleu_clf()
in code/src/evaluator.py
167 84 3
def forward()
in code/src/modules/multihead_attention.py
78 18 9
def build_attention_model()
in code/src/model/attention.py
74 12 3
def index_data()
in code/src/data/dictionary.py
68 17 6
def generate()
in code/src/model/attention.py
66 24 6
def eval_back()
in code/src/evaluator.py
58 23 4
def generate()
in code/src/model/seq2seq.py
56 22 6
def __init__()
in code/src/model/attention.py
55 18 3
def forward()
in code/src/model/attention.py
55 9 5
def __init__()
in code/src/model/seq2seq.py
53 15 3
def build_seq2seq_model()
in code/src/model/seq2seq.py
52 5 3
def check_ae_model_params()
in code/src/model/__init__.py
51 44 1
def __init__()
in code/src/trainer.py
50 10 7
def load_binarized()
in code/src/data/loader.py
48 15 2
def __init__()
in code/src/model/transformer.py
47 10 3
def get_optimizer()
in code/src/utils.py
46 14 2
def otf_bt()
in code/src/trainer.py
45 7 4
def generate()
in code/src/model/transformer.py
41 9 6
def generate()
in code/src/model/lm.py
39 15 4