microsoft / AzureML-BERT
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 254 units with 3,234 lines of code in units (74.1% of code).
    • 5 very long units (874 lines of code)
    • 9 long units (571 lines of code)
    • 18 medium size units (540 lines of code)
    • 39 small units (539 lines of code)
    • 183 very small units (710 lines of code)
27% | 17% | 16% | 16% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py27% | 17% | 16% | 16% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
finetune41% | 11% | 11% | 18% | 16%
finetune/PyTorch48% | 11% | 5% | 16% | 17%
finetune/TensorFlow24% | 21% | 17% | 17% | 18%
pretrain/PyTorch0% | 26% | 28% | 13% | 31%
pretrain/PyTorch/dataprep0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in finetune/run_squad_azureml.py
278 67 0
def main()
in finetune/PyTorch/run_classifier_azureml.py
244 47 0
def main()
in finetune/TensorFlow/run_classifier.py
130 23 1
def convert_examples_to_features()
in finetune/run_squad_azureml.py
121 32 6
def write_predictions()
in finetune/run_squad_azureml.py
101 20 9
def run_evaluation()
in finetune/run_classifier_azureml.py
86 28 3
def train()
in pretrain/PyTorch/train.py
86 6 1
def model_fn_builder()
in finetune/TensorFlow/run_classifier.py
64 8 8
def create_hooks()
in pretrain/PyTorch/distributed_apex.py
59 23 1
def __init__()
in pretrain/PyTorch/distributed_apex.py
57 13 11
def convert_examples_to_features()
in finetune/PyTorch/run_classifier_azureml.py
56 27 4
def read_squad_examples()
in finetune/run_squad_azureml.py
56 16 2
def convert_single_example()
in finetune/TensorFlow/run_classifier.py
54 26 5
def create_training_instance()
in pretrain/PyTorch/sources.py
53 17 2
def get_final_text()
in finetune/run_squad_azureml.py
50 21 4
def convert_examples_to_features()
in finetune/run_classifier_azureml.py
41 26 5
def input_fn_builder()
in finetune/TensorFlow/run_classifier.py
37 5 4
def create_masked_lm_predictions()
in pretrain/PyTorch/dataset.py
35 10 2
def forward()
in pretrain/PyTorch/distributed_apex.py
30 16 3
def synchronize()
in finetune/PyTorch/azureml_bert_util.py
29 9 1