tensorflow / nmt
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 142 units with 3,094 lines of code in units (88.6% of code).
    • 3 very long units (368 lines of code)
    • 12 long units (736 lines of code)
    • 36 medium size units (1,129 lines of code)
    • 37 small units (526 lines of code)
    • 54 very small units (335 lines of code)
11% | 23% | 36% | 17% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 23% | 36% | 17% | 10%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
nmt11% | 27% | 37% | 14% | 8%
nmt/utils16% | 18% | 32% | 19% | 12%
nmt/scripts0% | 0% | 38% | 32% | 28%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in nmt/train.py
142 15 3
def get_iterator()
in nmt/utils/iterator_utils.py
115 9 18
111 27 1
def _build_decoder()
in nmt/model.py
98 20 4
def create_standard_hparams()
in nmt/utils/standard_hparams_utils.py
70 1 0
69 5 1
def _build_decoder_cell()
in nmt/gnmt_model.py
64 11 5
57 15 14
56 5 10
def _build_decoder_cell()
in nmt/attention_model.py
55 8 5
def avg_checkpoints()
in nmt/model_helper.py
54 15 4
def decode_and_evaluate()
in nmt/utils/nmt_utils.py
54 12 12
def run_main()
in nmt/nmt.py
54 17 5
def multi_worker_inference()
in nmt/inference.py
53 7 8
52 5 12
def create_test_hparams()
in nmt/utils/common_test_utils.py
48 2 10
47 7 8
46 8 4
def create_train_model()
in nmt/model_helper.py
46 4 6
def get_infer_iterator()
in nmt/utils/iterator_utils.py
45 5 6